Server-side, client-side, code snippets, scripts, automation, best practices, proven approaches, tips & tricks...

Combining multiple Swagger API endpoints in a single UI

Multiple REST API microservices endpoints in a single Swagger UI
Shifting from traditional monolithic application architecture to micorservices can solve bunch of problems and issues monolith application application design approach introduces, but on the other hand it has it's own drawbacks, although number of drawbacks compared to number of problems it solves is a lot greater so it makes sense to take a path in process of moving from monolithic to micorservices. On of the steps to move to micorservices is to physically have your services running as individual processes...read more

Overwriting configuration values with environment variable in ASP.NET Core

Using environment specific variables to overwrite configuration values in ASP.NET Core
It is obvious that no matter what is the size and complexity of your application, configuration values on your local development machine and the environment where the application is going to run will be different. To avoid any hard-coding and recompilation of your code, the most common practice is to store application and environment specific values to configuration files...read more

Mocking System.IO filesystem in unit tests in ASP.NET Core

Testable filesystem operations in ASP.NET Core and C#
Working with file system operations like creating or deleting files and directories if quite often part of applications flow. Both .NET and .NET Core come with great out of the box classes and methods to achieve this. These classes and methods are part of System.IO name space, but unfortunately both .NET and .NET Core implementations are the same and they use static classes and method to manipulate files and directories on the host file system. ...read more

Generation Java client libraries for REST service with swagger-gen Azure DevOps

Compiling and serving MAVEN packages for Java with Azure DevOps using PowerShell
Generating client libraries for REST API which are documented with Swagger can significantly reduce product development time, especially on the front-end side. Well documented API can be easily interpreted by various tools to generate language specific libraries which can be then just easily integrated in in the API service consuming application. Some time ago I wrote an article Stop writing clients in C# for your Web APIs which explains how to use NSwag to generate NuGet packages for Swagger documented Web API REST services and to push them to Azure DevOps Artifact Feed...read more

Using options pattern in MVC5 legacy applications with web.config

Simple implementation of options pattern in .NET Framework 4.x legacy applications
The story behind New descendant of .NET Framework, .NET Core, comes with one really useful pattern for reading and using configuration files. It comes with out of the box support for JSON configuration files which are much more readable and give much greater freedom and flexibility on how to organize your settings...read more

Ignoring properties from controller action model in Swagger using JsonIgnore

Excluding properties from Swagger in controller action input model using Newtonsoft.Json package
While designing the REST API, quite often you may find yourself in a situation where the data can be provided from multiple sources, like route, query string or POST/PUT payload. While that might not be a big problem, it may force you to redesign your models and most likely you will end up with keeping your original DTOs but then designing a new model in your application services layer just to have all your data from different sources in one place when you are passing it to the service method. Resolving multiple sources custom binding ...read more

Increase service resilience using Polly and retry pattern in ASP.NET Core

Retry pattern in ASP.NET Core with Polly
Whether you are doing micro-services or mid-size monolith applications that do not have to be too distributed, there is a big chance that you will depend on some external HTTP service. Whether it is REST, SOAP or any other type of the response, your application flow depends on it's response. Sure using queues and event-based communication between services or components will definitely increase the resilience of the application and make more error-proof, it adds additional complexity to the whole solution and sometimes that can be an overhead depending on the application type or the infrastructure you might be limited with. ...read more

Strongly typed configuration sections with options pattern in ASP.NET Core

Loading configuration values directly to classes and use them in the runtime
Configuration is probably the most essential part of every application, yet we do not give much attention to it during application design and development. .NET Core has quite nice way to store configurations (usually JSON files) and already built-in extensions to access configuration values and directly cast them to a specific type...read more

Unit testing repositories in ASP.NET Core with xUnit and Moq

Mocking UserManager RoleManager and DbContext in unit tests in .NET Core
Unit testing is an important part for maintaining code quality and what is the most important thing, avoiding bugs in production. This is one of the reasons why unit tests and high code coverage is desired as a part of the project and as a part of the build process since you can detect potential bugs and issues during the build process when unit tests are executed...read more

Mixed model binding in ASP.NET Core using custom model binders

IModelBinder interface implementations usage for multiple source model binding
Patterns, conventions and standards are invented and enforced in order to make coding easier and more understandable for the developers, but in some cases certain patterns and conventions do not couple so easily and you have to rely on more on the actual technology you are using in order to overcome these complications. One of the cases this happens is using CQRS, especially commands and REST...read more

Cloning Windows Virtual Machine in Azure without having to stop it

Zero downtime cloning of Virtual Machine in Azure using PowerShell
Creating a copy of an existing Virtual Machine on Azure is not really that much straight forward as you might think. The proper way as described in the documentation is to "generalize" Virtual Machine which puts it into a state where it can be used as a template for creating new Virtual Machines...read more


read more

Umbraco CMS

read more


read more


read more