Entity Framework

Unit of Work implementation in the context of DDD, using EF and Unity

I’m going to keep the introduction short as I believe the title is pretty self-explanatory but I do want to emphasize from the beginning that the goal here wasn’t to create a ‘One to rule them all’ implementation of the Unit of Work pattern. There is a variety of feature-rich implementations online but before going for the ‘ultimate’ one I would advise following the Yagni principle. Start simple, learn what you need and adapt.

The main goal here is to show how this pattern fits with a DDD mindset and how it can be easily implemented using the technologies mentioned. I will demonstrate this in two popular scenarios:

  • A web application using ASP.NET Web API – the UI
  • A console application – the background process

Read More