Running microservices in Docker with Mono

Getting a service running under Docker is fairly straight forward once you have all the working parts together. I have an app written (following my guide on service and console in one), which uses Owin to serve a web page as a demo: install-package Microsoft.Owin.SelfHost public partial class Service : ServiceBase { //see the service console post for the rest of this protected override void OnStart(string[] args) { _app = WebApp....

September 5, 2015 · 2 min

A single project Windows Service and Console

I have found that when developing MicroServices, I often want to run them from within Visual Studio, or just as a console application, and not have to bother with the hassle of installing as windows services. In the past I have seen this achieved by creating a Class Library project with all the actual implementation inside it, and then both a Console Application and Windows Service project referencing the library and doing nothing other than calling a ....

August 30, 2015 · 3 min

Don't Let The Database Dictate Your Design

I have been thinking recently about how the database can influence our design decisions, and perhaps makes them harder than they need to be in some cases. An example of this is the design of a system which stores data about people, specifically for this, their email addresses. A cut down version of the structure is this: table people id serial primary key firstname varchar(50) lastname varchar(50) table emails id serial primary key person_id int => people....

April 1, 2015 · 5 min

The problems with and solutions to Repositories

Repositories are a design pattern which I have never been a huge fan of. I can see the use of them as a good layer boundary, but too often I see them being used all over the place instead of at an infrastructure level in a code base. A particularly prevalent version of this misuse I see is self populating collections. These generally inherit List<TEntity> or Dictionary<TID, TEntity>, and provide a set of methods such as ....

March 28, 2015 · 3 min

Communicating Intent in APIs

Recently was trying to work out how to allow custom resources to be specified in Dashen. I already know what data is needed/defined for a resource: a name, a MIME type, and a Stream. We can make this required data known very easily: public class Resource { public string Name { get; private set; } public string MimeType { get; private set; } public Stream Content { get; private set; } public Resource(string name, string mimeType, Stream content) { Name = name; MimeType = mimeType; Content = content; } } As all the parameters can only be set through the constructor, you are communicating that they are all required....

March 25, 2015 · 2 min

Encapsulation in Warcraft Addons - Inheritance

Using Inheritance (sort of) When we actually need inheritance, things get a little more complicated. We need to use two of lua’s slightly harder features to get it to work: metatables and colon notation. A little background on these will help: MetaTables All “objects” in lua are tables, and tables can something called a metatable added to them. Metatables can have special methods on them which run under certain circumstances (called metamethods), such as keys being added....

December 5, 2014 · 6 min

Encapsulation in Warcraft Addons - Closures

In the last post I alluded to the fact that if you put in a little leg work, you could write well encapsulated objects in lua. There are two main ways to do this; with closures, and with metatables. In this post we will deal with using closures, and in the next post we will cover using metatables. Using Closures The simplest way to write an object in lua is with a closure to hide all the variables from the outside world....

November 28, 2014 · 4 min

Good Design in Warcraft Addons/Lua

Lack of Encapsulation in Addons I first noticed a lack of good design in addon code when I started trying to tweak existing addons to be slightly different. One of the stand out examples was a Threat Meter (you know which one I mean). It works well, but I felt like writing my own, to make it really fit into my UI, with as little overhead as possible. Not knowing how to even begin writing a Threat Meter, I downloaded a copy, and opened its source directory… to discover that the entire addon is one 3500+ line file, and 16 Ace....

November 23, 2014 · 7 min

Edge.js for Embedded Webuis

We work we have a number of windows services which each have a lot of stats they could expose. Currently they are only interrogatable by the logfiles and from any notifications we receive. I have been toying with the idea of hosting a website in-process which would give a simple dashboard ui and access to a live view of the log file. The idea first struck me when I was experimenting with FubuMvc, as they have an EmbeddedFubuMvcServer, which is very easy to use:...

August 4, 2014 · 3 min

Configuring Dapper to work with custom types

In the last post we looked at using custom ID types to help abstract the column type from the domain. This works well until you start trying to load and save entities using an ORM, as the ORM has not way to know how to map a column to a custom type. ORMs provide extension points to allow you to create these mappings. As I tend to favour using Dapper, we will go through setting it up to work with our custom ID types....

July 22, 2014 · 4 min