Tag Archives: C#

Generating Files With Razor Engine

The Razor engine can be used outside of ASP.NET. Beside the cool syntax, it’s a very fast engine! And it’s quite easy to use. In my example I generate a XML file based on a razor template. (You have to install the NuGet package “RazorEngine”. This is my model which I use for the rendering:… Read More »

Demistifying async/await

Microsoft introduced new keywords in C# 5.0 for asynchronous programming. Before C# 5.0 async. programming was only possible with .NET Framework classes. Now it’s implemented in the C# language itself. Here is a simple demo which shows how the keywords can be used. public async Task<string> DownloadFromWeb() { var client = new HttpClient(); return await… Read More »

Next Generation Web With ASP.NET MVC, Knockout.js, SignalR, NServiceBus

Most of the websites that we know today, show a similar architecture: – The Client (Browser) request a specific page. – The Server handles the request and returns the result. – The result is displayed on the Browser. – From here the content of the site remains “static”. That means: If the user wants to… Read More »

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 »