Month: February 2016

Holistic Abstractions (Take 2)

In this post I will outline an updated perspective on Commands and Queries with respect to applying cross-cutting concerns (aka Aspects or Decorators). If you are unfamiliar with these two patterns then please see these posts here and here for a great introduction. Bertrand Meyer defines CQS as: every method should either be a command that performs an action, or… Read more →

dynamic code generation in c#

Copied directly from ayende.com Given a Dictionary<string, string>, convert that dictionary into a type in as performant a manner as possible. The conversion will happen many time, and first time costs are acceptable. public static Func<Dictionary<string, string>, T> Generate<T>() where T : new() { var dic = Expression.Parameter(typeof (Dictionary<string, string>), “dic”); var tmpVal = Expression.Parameter(typeof (string), “tmp”); var args =… Read more →