Category: code

NDepend, a first look

After reading @DaedTech’s very persuasive arguments for static code analysis I have decided to give NDepend a go. Download and install is slightly fiddly, you get a zip file with a number of files. Once you have found the instructions on the web site it takes just a couple of minutes to get set up. I analysed my current project… Read more →

Generate POCO’s from Sql Server

DECLARE tableCursor CURSOR LOCAL FOR SELECT name, ‘Foundation’, name + ‘Dto’ FROM sys.tables WHERE 1 = 1 OPEN tableCursor DECLARE @tableName NVARCHAR(MAX), @schemaName NVARCHAR(MAX), @className NVARCHAR(MAX) FETCH NEXT FROM tableCursor INTO @tableName, @schemaName, @className WHILE @@FETCH_STATUS = 0 BEGIN DECLARE tableColumns CURSOR LOCAL FOR SELECT cols.name, cols.system_type_id, cols.is_nullable FROM sys.columns cols JOIN sys.tables tbl ON cols.object_id = tbl.object_id WHERE tbl.name… Read more →

Property Copy – http://stackoverflow.com/a/2624847/1515209

using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace MiscUtil.Reflection { /// <summary> /// Generic class which copies to its target type from a source /// type specified in the Copy method. The types are specified /// separately to take advantage of type inference on generic /// method arguments. /// </summary> public static class PropertyCopy<TTarget> where TTarget : class, new()… Read more →

Commands and Queries are Holistic Abstractions

This post has been updated Click here In this post I will outline an updated perspective on Commands and Queries. If you are unfamiliar with these two patterns then please see these posts here and here for a great introduction. For the remainder of this post I will assume you have fully subscribed to the idea of parameter objects and… Read more →

Method Injection with Simple Injector

In this post I will outline a trick I created while experimenting with the code for my post Managing Commands and Queries. If you are unfamiliar with these two patterns then please see these posts here and here for a great introduction. For the remainder of this post I will assume you have fully subscribed to the idea of parameter… Read more →

Managing Command and Query Parameter Objects

In this post I will outline some of the techniques I employ to manage my Commands and Queries. If you are unfamiliar with these two patterns then please see these posts here and here for a great introduction. For the remainder of this post I will assume you have fully subscribed to the idea of parameter objects and are comfortable… Read more →