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

Data concurrency in Entity Framework Core
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
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

Extending Serilog with additional values to log

Adding additional information to log in .NET Core application with Serilog
If you are building .NET Core application your choice for logger library is most likely Serilog. It is really powerful and easy to use library which allows you easy logging in all levels in your application. One of the best features it has is easy extending of the data you want to have in your logs ... read more

Logging EF Core actions to a file using Serilog

Log Entity Framework Core using Serilog in .NET Core application
Logging is an essential part of the application. It gives you insights which allows you to see your application behavior or even user behaviour and actions taken by them in the application.Serilog is most probably the most popular library for logging in .NET Core applications ... read more

Using custom request and response serializers in ASP.NET Core

Configuring input and output serailzer/deserialier in ASP.NET Core pipeline
This is not a new subject and the support for handling WebApi input and output was introduced in .NET Core 2.0 and it's been there since then. There are couple of useful pages out there and it is even well documented on Microsoft official page Custom formatters in ASP.NET Core Web API ... read more

Setting up .NET Core development environment on Ubuntu Linux

A quick guide for switching from Windows based Visual Studio 2017 to Visual Studio Code
With growing popularity of dotnet Core, Git and Docker, developers who used to work mainly on Windows are now getting used to CLI environment and obviously Linux. Windows is still a development environment platform of choice, bit since Microsoft already developed and published Visual Studio Code as a cross platform IDE for Windows, Linux and Mac. Although it is still not mature as Visual Studio 2017, it is a decent tool for .NET Core applications development ... read more

Reloading the cache automatically once expired is ASP.NET MVC

Load values to in memory cache as soon as they expire in ASP.NET MVC
In memory caching is not a bullet proof way of caching data in an application, especially if this application is distributed. The lack of synchronization between nodes can cause you application to misbehave showing wrong data or even throwing exceptions and crashing. This is one of the main reasons why distributed caching is the best way of doing the caching in your web application. But not all applications you might be developing need to run as distributed on multiple machines ... read more

Get most visited pages of your website from Google Analytics using C#

List most visited website pages from Google analytics in your .NET application code
If you have a website like this one with articles and you would like to suggest most visited articles to your visitors, there are few ways to do this. One of them is definitely a custom solution that can track and store count of every visit per page you have, or without any re-inventing of wheel you can just hook to Google Analytics API to pull the data ... read more

Creating Windows service and Linux daemon with the same code base in .NET

Cross-platform service with C# and .NET Framework
Few months back I wrote an article on how to create Linux daemon in .NET Core using generic host class introduced in 2.1 version of .NET Core. This code works just great on Linux OS when configured as a daemon in systemd and provides more less same concept you would have with Windows Service written in .NET Framework 4.x. The code works just fine on both Windows and Linux hosts, but because it is compiled as a Console Application, you do not really get to run it on your Windows machine as a Service ... read more

Minify ASP.NET MVC Core response using custom middleware and pipeline

Html response content minification on the fly in ASP.NET Core
For my website, since it runs on Umbraco 6 and it is basically ASP.NET MVC application. To reduce load time and increase website performances I decided to alternate the response of the application and minify it using simple regular expression. Initially I was trying to do this with YUI Compressor library which has .NET port as NuGet YUICompressor.NET which works fine in most of the cases, but in my case does not skip PRE tags which I use for code snippets on the website ... read more

Background working scheduled task in ASP.NET Core MVC application

Using Quartz for scheduling background tasks in .NET Core MVC applications
Caching common data like lookups for example in memory of your app can increase significantly your MVC web application performances and response time. Of course this data has to be periodically refreshed. You can use various approaches to refresh data including expiry, but this can create potential bottle necks in your application since once data expires, you will use request thread to pull the data, cache and serve the request response back ... read more

Simple pixel conversion tracking implementation in ASP.NET Core WebApi

Conversion tracking implementation using pixel method in ASP.NET Core
Pixel tracking, although it is the oldest method for tracking conversions in marketing, it is still used widely and some big companies like Facebook are still overing it as one of the methods for tracking the conversions of on your web pages. Tracking conversion via pixel method is still widely used because of it's simplicity ... read more

Limit number of tasks running at the same time in .NET

How to throttle number of running tasks to a specific number in C#
Limiting the number concurrently running Tasks is not that often requirement in a code, but eventually you'll find yourself in the situation that for the most likely performance issues you'll have to limit number of concurrently running Tasks. One of these situations is when you have long running operations in the Task. If you spin up to many Tasks you will seriously degrade your application performance ... read more

Request Filtering in ASP.NET Core using Middleware and request pipeline

Filter requests in ASP.NET Core application through request pipeline configuration
ASP.NET Core comes with advanced request processing thrugh pipepline configuretion of the .NET Core middleware elements. You can easily specify the steps that will be exscuted on the request object all the way until the response is returned back ... read more


read more


read more

Umbraco CMS

read more


read more