Tag Archives: .NET

Entity Framework Code First And SQL Server DACPAC

Entity Framework Code First Migrations allows you to handle changes in your model (C#) by generating “migration scripts” for keeping the DB in sync with the code. It works very well. But I never used it in a project with more than 1 developer. I think we could run in different problems. And managing all… Read More »

It’s Worth To Be Lazy<>

In the past few projects I saw a lot of wrong implemented Singleton patterns. Since Microsoft released the class “Lazy” in .NET 4.0, Singleton is much easier to implement. So… be lazy and use the class Lazy 😉 Here is an example: This code here initializes the “_instance” variable when accessing the the “Instance” property… Read More »

Onion Architecture – C#.NET

If you never heard about the “Onion Architecture”, you should read Jeffrey Palermos blog post. He’s the Onion-Architecture-Guru 😉 I created a very small demo VS.NET solution, which shows how I would apply this type of architecture in a project. (The download link is at the bottom of this post.) The following graph displays the… Read More »

Entity Framework ‘Code First’ Approach and Domain-Driven Design

With the Code First approach we can create clean entities without any EF specific code. After the first demo, I saw that you have to deal with the IDbSet interface, which is placed in the Entity Framework library. When you place the entities in your business dll you have to reference the EF library. This… Read More »

Easier Programming With Dynamic Data Type .NET 4.0

When you deal with very dynamic dictionaries, you have always to check if the data exists before accessing it. This can blow up your code. With the dynamic data type (.NET 4.0) you can do this a little bit more elegant. Example: Here are my data classes. You see that the Person class has a… Read More »