WebLog

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

Setting up SQL Server IDistributedCache with migration in ASP.NET Core

Embedding SQL Server caching in a project with EFCore migration
 
0
Caching data using Microsoft SQL Server may not be the most popular way of caching data because of the performance comparing to caching data to Redis, but it is maybe the most convenient way to keep your state of the application outside the process itself. Beside, if you are already using SQL Server database, you can just move the caching infrastructure to a separate schema inside the same database and keep using it until requirements are met for cache storage of better performance (like Redis for example). This makes infrastructure not so complex and less dependent, again until the requirements for something faster are met. ...read more

Accessing multiple databases from the same DbContext in EF Core

Multiple database access from the same DbContext in Entity Framework Core 5
 
 
0
It is not uncommon to have a requirement to access tables or views in different databases in the same query. In order to be able to do your joins on tables or views in different databases you need to do it in the same connection instance which is bound to DbContext, therefore this access as to be accomplished from the same DbContext instance...read more

Customizing WSL2 on Windows with screenfetch and oh-my-zsh

Setting up screenfetch and oh-my-zsh for use in WSL2 and Windows Terminal
0
Windows Subsystem for Linux or WSL i a great way to have a Linux environment easily accessible from your development environment on Windows. With latest Windows10 May 2020 update 2020H1 WSL got a major update WSL2 which enables even more fluent integration of Linux kernel into Windows10. I will assume that you are already using WSL2 and you are familiar with initial setup of it on Window10...read more

Building and using advanced .NET Core CLI global tools

Handling commands, arguments and options in .NET CLI global tool application
 
0
Once .NET Core 2.1 SDK introduced support for global tools I wrote a brief article on how to create a simple global CLI tool in .NET Core Building advanced .NET Core Global Tool using CommandLineUtils package. While this is fair enough informations to kick-start you project and create a simple global tool to use from the command line, I found out there is more to it in order to have the tool built, published, distributed and used especially when you are dealing with real-life applications that need to have a CLI as a part of the solution. ...read more

Seeding data in EF Core using SQL scripts

Another way of seeding data in EF Core
 
0
Not so while ago I wrote an article on Seeding data with Entity Framework Core using migrations. This approach relies on EF Core migrations to ensure seeding of specific data is done only once using __EFMigrationsHistory table to track structural migrations as well as data seeding migrations. In large number of cases this approach works just fine and you do not need to do any adjustments or add any additional tables, just use migrations mechanism out of the box...read more

Seeding data with Entity Framework Core using migrations

Using EF Core migrations to seed the data
 
0
As much as it is important for testing the functionality of the application, data seeding can also be used to pre-load some values like lookups not only to development and test environment but also to populate these values in production as well. Seeding of data can be done in several ways and in this article I will go through two ways of seeding data. Both of them have their pros and cons and it is up to you to pick the way you want to have your data pre-seeded in your application database. ...read more

Identifying opened connections for the specific application in SQL Server

Connection listing queries in SQL Server
0
Object relational mappers or ORMs are a great tool which can significantly reduce application development time, but if they are not use wisely they can cause bottlenecks and performance issues. Same goes for dependency injection containers. The lifetime of the components, especially the ones that can cause recurse locks like SQL Server connections must be as short as possible and they should be released as soon as work is done. ...read more

Using Polly for retrial policies with Autofac

Confguring and using Polly with with pretty much anything
0
Some time ago I wrote an article which explains how to Increase service resilience using Polly and retry pattern in ASP.NET Core. This is a great way how to easily implement retrials when using .NET Core dependency injection, but in case of using Autofac with .NET Framework 4.x you do not have many out of the box solutions. However, Polly as a library is not specifically built for .NET Core and using it with other dependecy injection packages such as Autofac is fairly easy...read more

JavaScript

read more

Umbraco CMS

read more

.NET

read more

SQL/T-SQL

read more