Paramore Brighter: Using .NET Core’s Dependency Injection

This is the first in a series of posts on Paramore.Brighter. I’m writing this as a series of recipes, with the aim of you picking up a point quickly and getting going with it. The code for this post is on GitHub, you can find it here: GitHub Basic solution In .NET Core there is […]

Join Null Check with Assignment

I recently wrote some code and asked ReSharper to add a null check for me, which it did. Then it suggested that I could simplify the null check by joining it to the assignment. Intrigued, I let it. The code went from this: public void SetMessage(string message) { if (message == null) throw new ArgumentNullException(nameof(message)); […]

Aggregate of columns, not rows

In SQL Server it is very easy to aggregate a value across many rows. You simply just write something like this: SELECT MAX(SomeColumn) FROM SomeTable This will return one row with the aggregate value (in this case MAXimum) of the column. However, what if you want to do this across columns. What if you have […]

But why is the iterator operating in multiple-threads

Background Recently, I had a bit of a problem with NHibernate when I was converting some code into parallel tasks. (If you have no interest in NHibernate, then don’t worry – it is just background to the issue I was having when I spotted this gulf between my expectation and reality. NHibernate is incidental to […]

Overusing the Null-Conditional Operator

The null-conditional operator is the ?. between object and field/property/method. It simply says that if the thing on the left hand side is null then the thing on the right hand side is not evaluated. It is a shorthand, so: if (a != null) { a.DoSomething(); } becomes a?.DoSomething(); And that’s great. It makes life […]

Application Configuration in .NET Core – Part 2

In the first part we got started by pulling in configuration data from multiple source in .NET Core, in this part we’ll look at mapping the configuration onto a set of classes so that is becomes easier to access. This is something that is built into ASP.NET Core through dependency injection, so we’ll look at that. […]

Application configuration in .NET Core – Part 1

.NET Core has a new way of working with configuration that is much more flexible than the way that previous versions of .NET have. It allows you to: Pull configuration from multiple sources and bring it in to one place. Easily map that configuration information into classes to make access easier. Override configuration from previous […]

Setting up Ubuntu for .NET Development

First up, at the time of writing only Ubuntu 14.04LTS is supported. I’ve read that it will work on 15.04, but I know it won’t work on 15.10 because of a binary incompatibility on a library that .net core relies on. Step 1: Install the .NET Execution Environment Follow the instructions at https://docs.asp.net/en/latest/getting-started/installing-on-linux.htm This will install […]

Using GitHub Two Factor Authentication (2FA) with TeamCity

If you have two factor authentication (2FA) set up in GitHub and you also want to use TeamCity, the easiest way to set this up is to set up SSH keys to access the GitHub repository. The first step is to follow this guide to creating SSH keys for GitHub. Remember the passphrase you use […]

Debugging a process that cannot be invoked through Visual Studio.

Sometimes it is rather difficult to debug through Visual Studio directly even although the project is right there in front of you. In my case I have an assembly that is invoked from a wrapper that is itself invoked from an MSBuild script. I could potentially get VS to invoke the whole pipeline but it […]