Round Robin class

We recently had need of a round robin functionality and since there is no round robin class built into .NET I needed to build my own class. It is a fairly simple algorithm, each call returns the next item in the sequence. When the end of the sequence is reached go back to the beginning …

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 …

DDD Scotland final agenda

We’ve finalised our agenda and already people have said they’re finding it difficult to decide which sessions to see and which they’ll have to miss out on. #dddscot agenda already looking good, can see some hard decisions to be made on what to see — Nathan Gloyn (@NathanGloyn) March 15, 2016 For full information visit …

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 …

Tip of the Day: Calculating durations with Moment

Moment has quite a nice fluent interface for some operations, others just need a little more thought. For example, I wanted the duration of something and I had recorded the start and end time. I thought something like this, finding the difference between two dates and converting it to a duration, would work: var duration …