.NET - November 2018

Using DisplayName attribute for model validation output in ASP.NET MVC Core

Returning DisplayName attribute value in model validation response in MVC Core
0
Model validation is an important part of request life-cycle and pipeline in MVC Core regardless whether you are building Web API project or ASP.NET MVC web application. Both project templates rely on the common ASP.NET Core platform therefore validation is pretty much the same in both type of projects. Because Web API and micro services are more popular nowadays, I am going to use Web API sample project to demonstrate how to modify validation response in MVC Web API Core project. ...read more

Dependency injection with custom MVC filter attributes in ASP.NET Core

Using dependency injection with custom ExceptionFilterAttribute in ASP.NET Core
0
Apart from adding your own middleware to the ASP.NET MVC Core application pipeline, you can control the response using custom MVC filter attributes and selectively apply them to either whole controller or controller actions. One of the commonly used MVC filter in ASP.NET Core is ExceptionFilterAttribute for handling error response in Wep API applications. It is easy to implement and I also wrote an article about Error handling in ASP.NET Core Web API few months ago...read more

Adding healthchecks just got a lot easier in ASP.NET Core 2.2

Setting up and using healthcheck endpoints in ASP.NET Core 2.2
0
Health checks or health probes are the crucial part for orchestrating micro services. If you are using Kubernetes for orchestrating containerized application instances or you just have multiple ServiceApps or VMS behind the load balancer, you need to define health checks in order for the orchestrator or load balancer to know to which instance to send the traffic and to which not...read more

Mocking IConfiguration GetValue<T> extension methods in Unit Test

How to mock extension methods for IConfiguration in .NET Core
0
Now here is a trouble that was bugging me for some time and I guess who ever is using IConfigration injected in the constructor and using extension methods to access configuration values reached whan trying to write Unit Tests. IConfiguration interface is a great way to easily replace your configuration layer in application, but it has it's drawbacks. The way interface envorces configuration reading is by exposing GetSection method which return IConfigurationSection...read more

Handling data concurrency in EF Core and ASP.NET Core WebAPI

Data concurrency in Entity Framework Core
 
0
Entity Framework Core implements optimistic concurrency strategy which is opposite to pessimistic concurrency strategy. Lets's first clear out what are main differences between these two approaches in concurrency control. Optimistic concurrency control allows multiple processes to access and modify data without any explicit lock on the data...read more

Setting up Swagger to support versioned API endpoints in ASP.NET Core

Adding Swagger support for versioned REST Web API endpoints
 
0
Versioning of your endpoints is important especially if you have 3rd party dependent clients of your REST API service. Any change in your endpoint, for example in data structure may impact clients even if it is backward compatible, clients may process your endpoint data in different ways, so even adding one additional property to your model may also impact functionality of the client which is consuming your endpoint. Prerequisites ...read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more

PowerShell

read more