Quantcast
Channel: Andrew Lock | .NET Escapades
Browsing all 743 articles
Browse latest View live
↧

Image may be NSFW.
Clik here to view.

Using snake case column names with Dapper and PostgreSQL

This is a follow on to a previous post about customising naming conventions for PostgreSQL and EF Core. In this post I describe one way to use snake case naming conventions when using Dapper, rather...

View Article


Image may be NSFW.
Clik here to view.

Adding Segment client-side analytics to an ASP.NET Core application

Virtually all web applications use some form of user analytics to determine which aspects of an application are popular and which are causing issues for users. Probably the most well known is Google...

View Article


Image may be NSFW.
Clik here to view.

Running smoke tests for ASP.NET Core apps in CI using Docker

In this post I'll discuss a technique I use occasionally to ensure that an ASP.NET Core app is able to start correctly, as part of a continuous integration (CI) build pipeline. These "smoke tests"...

View Article

Image may be NSFW.
Clik here to view.

Why isn't my ASP.NET Core environment-specific configuration loading?

I was recently standing up a new ASP.NET Core application running in Docker, and I was seeing some very strange behaviour. The application would start up without any problems when running locally on my...

View Article

Image may be NSFW.
Clik here to view.

The difference between GetService() and GetRequiredService() in ASP.NET Core

This post looks at the GetService<T>() and GetRequiredService<T>() methods of the default/built-in ASP.NET Core DI container, provided in Microsoft.Extensions.DependencyInjection. I'll...

View Article


Image may be NSFW.
Clik here to view.

How to register a service with multiple interfaces in ASP.NET Core DI

In this post I describe how to register a concrete class with multiple public interfaces in the Microsoft.Extensions.DependencyInjection container used in ASP.NET Core. With this approach you'll be...

View Article

Image may be NSFW.
Clik here to view.

Using Scrutor to automatically register your services with the ASP.NET Core...

In this post I describe how to use the open source library Scrutor by Kristian Hellang to add assembly scanning capabilities to the ASP.NET Core DI container. Scrutor is not a dependency injection (DI)...

View Article

Image may be NSFW.
Clik here to view.

Adding decorated classes to the ASP.NET Core DI container using Scrutor

In my last post, I described how you can use Scrutor to add assembly scanning to the ASP.NET Core built-in DI container, without using a third-party library. Scrutor is not intended to replace...

View Article


Image may be NSFW.
Clik here to view.

Creating an ASCII-art tree in C#

I recently made my first pull request to the Cake project in which I added a command line option (--showtree) to display the tasks in a Cake script in a tree view. Creating the tree view itself took me...

View Article


Image may be NSFW.
Clik here to view.

Building an open source GitHub project using Azure DevOps

In this post I show how I added Azure DevOps CI to one of the .NET Standard library I have on GitHub. I'll walk through the various steps I took to get CI/CD working for pull requests and the master...

View Article

Image may be NSFW.
Clik here to view.

Using multiple instances of strongly-typed settings with named options in...

ASP.NET Core has used the Options pattern to configure strongly typed settings objects since before version 1.0. Since then, the feature has gained more features. For example ASP.NET Core 1.1...

View Article

Image may be NSFW.
Clik here to view.

The dangers and gotchas of using scoped services in IConfigureOptions

The configuration system in ASP.NET Core allows you to load key-value pairs from a wide variety of sources such as JSON files, Environment Variables, or Azure KeyVault. The recommended way to consume...

View Article

Image may be NSFW.
Clik here to view.

Configuring named options using IConfigureNamedOptions and ConfigureAll

This is a follow on to my previous post on using multiple instances of strongly-typed settings in ASP.NET Core 2.x. At the end of that post I introduced the concept of named options which were added in...

View Article


Image may be NSFW.
Clik here to view.

Delaying strongly-typed options configuration using PostConfigure in ASP.NET...

In this post I describe a scenario in which a library author wants to use the Options pattern to configure their library, and enforce some default values / constraints. I describe the difficulties with...

View Article

Image may be NSFW.
Clik here to view.

Simplifying dependency injection for IConfigureOptions with the...

In recent posts I've been discussing the Options pattern for strongly-typed settings configuration in some depth. One of the patterns that has come up several times is using IConfigureOptions<T>...

View Article


Image may be NSFW.
Clik here to view.

Creating singleton named options with IOptionsMonitor

In recent posts I've been discussing some of the lesser known features of the Options system in ASP.NET Core 2.x. In the first of these posts, I described how to use named options when you want to have...

View Article

Image may be NSFW.
Clik here to view.

Generating .editorconfig files automatically using IntelliCode

In this post I show how to install the experimental IntelliCode extension in Visual Studio, and how to use it to generate an EditorConfig file from your existing code. Background I was catching up on...

View Article


Image may be NSFW.
Clik here to view.

Caching Docker layers on serverless build hosts with multi-stage builds,...

In this post I describe how I improved the build performance of my ASP.NET Core Docker containers when building on a serverless host that doesn't provide any layer caching. I used a combination of...

View Article

Image may be NSFW.
Clik here to view.

Secure secrets storage for ASP.NET Core with AWS Secrets Manager (Part 1)

An important aspect of running ASP.NET Core apps in the cloud is how you secure the secrets your app requires, things like connection strings and API keys. In this post, I show one approach to securing...

View Article

Image may be NSFW.
Clik here to view.

Secure secrets storage for ASP.NET Core with AWS Secrets Manager (Part 2)

In my last post, I showed how to add secrets to AWS Secrets Manager, and how you could configure your ASP.NET Core application to load them into the .NET Core configuration system at runtime. In this...

View Article
Browsing all 743 articles
Browse latest View live