Send mail to the author(s) E-mail

# Friday, July 25, 2014
( Git )

This solves the problem in VS2013 git - it can get confused and seemingly ignore the gitignore file.

Take an existing solution eg:

Already compiled, and has NuGet packages

Do a git init from the command line.

Make a  .gitignore.   (otherwise windows wont let you name it), a good community example is from

Add all files to git

Open up the solution, and now we have everything excluded that we want

Push to GitHub

Then do a clone in VS as a sanity check


NuGet getting packages as it should.  Cloned solution works.

| | # 
# Thursday, July 24, 2014

Looking in the Event Viewer, System, ever since I’ve had this PC I’ve been getting:

Windows Hardware Error Architecture

WHEA-Logger warnings:

A corrected hardware error has occurred.

Reported by component: Processor Core
Error Source: Corrected Machine Check
Error Type: Cache Hierarchy Error
Processor APIC ID: 2

The details view of this entry contains further information.


update BIOS and drivers for motherboard

maybe bump up voltage. offset +0.100?


Tested okay

BIOS is at latest version – F7

Updated all drivers on their website ie LAN, Audio, VGA


Device manager happy.

2014-07-25 13.31.55
Set motherboard back to optimized defaults.

Tried vCore up to 1.4  No difference

2014-07-25 14.49.44
Memtest running - fine so far.  It passed

I notice there are more errors the higher the processor load

Updated BIOS to F8b (beta) which made no difference.,14859.0.html

On low CPU load, the warning happens every minute or so

| | # 
# Tuesday, July 22, 2014

Getting the most out of your machine:


CPU: 4790K


Have gone from BIOS F6 to F7

Motherboard: Z97X-UD3H

Intel Devil's Canyon Core i7-4790K CPU Cinebench results

So possible 10% increase in perf going from 4.4 to 4.8


Look at BIOS update..

latest is F7 – 19/06/2014.  Had to format a mem stick to Fat32, copy the files over, then reboot and run the flash update in the BIOS.  - management?



Overclocked to 4.5GHz – Changed the Performance Upgrade switch in the BIOS


no overclock (4.4GHz.. or 4.0?)



Also how to find drivers

Installed :  Intel Management Engine Inerface.. got rid of 1 device not there.

And an INF update.. all good.

EasyTune.. need Gigabyte AppCenter utility


| | # 
# Wednesday, July 16, 2014


Going for a minimal install, but with client tools.  Also put on mixed mode authentication.  Rest are defaults.

| | # 

Disabling outlook alerts (2013)

setup power saving (if using desktop) to performance


setting up mstsc (inbound) – proving to be hard as I’m on a VPN to a corp network, so it should just work.

| | # 

“DI is a way to enable loose coupling, and loose coupling is first and foremost an efficient way to deal with complexity”


“Anyone can draw a three-layer application diagram, and [this] proves that I can, too”!

Building a tightly coupled application

MVC, EF and MSSQL application.  E-commerce.

  • List of featured products
  • If user is a preferred customer, the price on all products should be discounted by 5%

Data Layer

Creates a table in SSMS

Uses EF to create an Entity Model (db first).  She has changed Featured to IsFeatured in the model

Domain Layer

How to know who is a preferred customer?

    public partial class ProductService {
        private readonly CommerceObjectContext objectContext;

        public ProductService() {
            this.objectContext = new CommerceObjectContext();

        public IEnumerable<Product> GetFeaturedProducts(
            bool isCustomerPreferred) {
            var discount = isCustomerPreferred ? .95m : 1;
            var products = (from p in this.objectContext
                            where p.IsFeatured
                            select p).AsEnumerable();
            return from p in products
                   select new Product {
                       ProductId = p.ProductId,
                       Name = p.Name,
                       Description = p.Description,
                       IsFeatured = p.IsFeatured,
                       UnitPrice = p.UnitPrice * discount

She implements this in the domain layer.  However she needs a reference to the DAL as ObjectContext is defined there.

UI Layer

public ActionResult Index() {
    bool isPreferredCustomer = this.User.IsInRole("PreferredCustomer");

    var service = new ProductService();
    IEnumerable<Product> products = service.GetFeaturedProducts(isPreferredCustomer);
    this.ViewData["Products"] = products;

    return this.View();

Needs a reference to Domain layer, and DAL (as products are defined there). 

The answer as to why this was failing to compile on line 12 becomes clear when you use the type explicitly


Ahh, it is Product. Need a reference to System.Data.Entity (EF4) for EntityObject which Product inherits from.


As I couldn’t get the project to compile easily (MVC3) in VS2013, I created a new MVC5 and fitted in the code.

@using Ploeh.Samples.Mary.ECommerce.Data.Sql

<asp:Content ID="indexTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Featured Products</h2>
        @foreach (var prod in (IEnumerable<Product>) ViewData["products"]){
            <br />
            <br />

and web.config

    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5.1">
        <add assembly="System.Data.Entity, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

to get a reference to System.Data.Entity.  Also had to make sure the connection string was pointing to .\SQLEXPRESS where I generated the database.


Did Mary succeed?  No.  It looks like the coveted layered application, but the code is tightly coupled

Dependency graph showing how the modules depend on each other.  The arrows point towards a module’s dependency

The UI is dependant on both the Domain and Data Access layers!  It seems the UI may bypass the Domain in certain cases.

Evaluating Composability

Is it possible to use each module in isolation?

What is we want to replace the UI with a WPF one? – yes because nothing depends on the UI

Want to replace the DAL with one for Azure Table Store – no because domain and UI depend on it

IEnumerable<Product> products = service.GetFeaturedProducts(isPreferredCustomer);
  • UI reference Product which is defined in the DAL
this.objectContext = new CommerceObjectContext();
  • Domain library – tightly coupled to the DAL
  • A public Product class belongs in the Domain Model
  • Preferred Customer code is in UI whereas it belongs in the Domain Model
  • ProductService in Domain relies on web.config (for EF) – should be impertively configurable by callers
  • View contains specific string formatting.. should be in underlying model

Rebuilding the Commerce Application

Outside-in technique.  Here that means starting from the UI.  Closely related to You Aint Gonna Need It YAGNI.

He wrote a lot of unit tests in writing this application, as uses TDD

UI - FeaturedProductsViewModel


Interfaces or Abstract classes? – Important part is that you program against some sort of abstraction

custom IControllerFactory which will create an instance of the concrete ProductRepository and supply it to the home controller’s ctor.


Composition Root

Push the burden of controlling the dependency into another class – a composition root at the top of the application.  Where the different modules of an application can be composed.

Data Access

Using a separate Product POCO in the domain compared with auto generated Product in the DAL.  Aneimic model.

How dependencies are being connected

  • Injects SqlProductRepository into a new instance on HomeController
  • Index creates a new ProductService passing SqlProductRepository and invoking GetFeaturedProducts

Domain library has no dependencies!

  • Can we replace the WebUI with a WPF one.  Yes.  Nothing is dependant on it
  • Can we replace the Data Access library.  Yes.  It is loaded with late binding and the type is defined in web.config.

Late binding cannot find the DAL type – this can be solved by adding a reference from the UI to SQL layer.  Defeats the object (I think) though!  Ahh  -  so the point here was to show they are separate.  Copy in the dll and all will be well.  No direct references so everything is separate.

Domain Unit Tests

For fun am going to explore the tests he wrote while developing this application.  Split tests into

  • ProductTest
  • DiscountProductTest
  • ProductServiceTest

Uses AutoFixture  which he is a author on.  Design to:

“minimize the 'Arrange' phase of your unit tests”

Also Moq and xUnit

MVC Unit Tests

More difficult as lots has changed in MVC5.2 from 3.

| | # 
# Monday, July 14, 2014
( Resharper | Xunit )

Resharper Manage Extensions


| | # 
# Friday, July 04, 2014

Rohans talk

What book?

Dave Kerr.. knows about messaging


Framework for doing a distributed application

Separate machines eg Web -> create user -> Console app picks up message to save... -> raise an event that this has happened

Another ConsoleApp picks up that message and then sends an email


MSMQ, RabbitMQ, Tables(!) in a DB, Azure

  • Error queue
  • Auditing


Why have an Interface over an Attribute for NServiceBus eg ICommand (a marker interface)

Command is somehting want to happen

Event is something after it happens

Resilient... eg if emailler console app went down.

Starbucks Analogy

1person - take order

cup is the message (written on)

1 person - makes


Other Products

NServiceBus and MassTransit started using MSMQ

EasyNetQ is a light .NET wrapper around RabbitMQ (Erlang open source)

RabbitMQ is a much more feature rich queuing system.. than MSMQ... perf slightly better at 8k messages per sec compare to 5k

| | #