Vaughan

ASP.NET Core dependency injection: Registering open generics

.NET Core

A really interesting trick you can do with the ASP.NET core dependency injection is that you can register an open generic type. The prime example is the ILogger interface that is built in. Each class can inject a ILogger of its type without having to register it specifically. It can be quite a powerful technique […]

Read more
Vaughan

ASP.Net Core Hosted services

.NET Core

In the containerized application and Kubernetes world, quite often you need to create services that aren\’t traditional rest endpoints. Your application could for example rather listen to a message queue to process requests. It would be nice to still have all the nice infrastructure of .NET Core applications and things like health checks but have […]

Read more
Vaughan

ASP.NET Core configuration in Docker containers

.NET Core, Docker

In the old days of .NET applications we had a simple xml configuration file that would ship with each environment. This was tried and tested and was well understood. Then came Docker. The promise was that I could build a container on my machine and then ship that exact container to production. This is great […]

Read more
Vaughan

Docker with certificates

Docker

Sometimes when connecting to internal systems you need trusted certificates to be able to authenticate. Generally the base docker image you use when running ASP.NET core applications would not have your internal company certificates. You need a way to deploy these in your container so that your endpoints work. One way that you could do […]

Read more
Vaughan

ASP.NET Core with IOptions

.NET Core

One of my favorite improvements when moving to ASP.NET Core applications is that configuration feels like a first class citizen in the infrastructure. Previously I often had to do some manual work in the DI registration to create configuration objects that could be injected into my classes. No longer! ASP.NET Core uses the options pattern […]

Read more
Vaughan

Why I started contributing to open source

Open source

About a month ago I made my first commit to the grpc-dotnet project. It was a small change but it was more about the intent for me. Since then I’ve submitted a few other pull requests to that project and also the aspnetcore project. Some have been merged and others are waiting. Some would say […]

Read more
Vaughan

ConcurrentDictionary internals

Internals

The nice thing about .net being opensource is that at any time you can look at the source of interesting classes that you rely on. In this post I look at the ConcurrentDictionary class to get a better idea of how Microsoft writes threadsafe classes. As a recap: generally a normal dictionary is implemented internally […]

Read more
Vaughan

Present value in code

Finance

To try show some of the financial concepts in practice I\’ve create a library on github to track it – FinanceLibrary. I\’m not going to include the tests below but I added tests to each class as I created it. Have a look at the project for a more complete view. The first calculation I […]

Read more
Vaughan

What is Present Value?

Finance No Comment

Present value is an important calculation across a bank as its use to calculate a traders positions total mark-to-market. ie: How much are all their trades worth? So the idea is actually quite simple. The value of an instrument is the combined value of all the future cash flows of the instrument. So for example […]

Read more
Vaughan

The problem with the BlockingCollection

MultiThreading, Testing

The BlockingCollection is a really powerful thread-safe collection that can be a really powerful tool to use where appropriate. Generally you could consider it where you have a common instance of a class accessed from multiple threads. It gives the class control on how many items are added or taken in a thread-safe way. Calling […]

Read more

BMC logoBuy me a coffee