Showing posts from September, 2014

Complex type in EFCodeFirst

I have already written a few blog post about EF Code first and it’s features following is a complete list of blog posts.

Entity framework code first and inheritance- Table Per Type
Entity Framework code first and Inheritance–Table per hierarchy
Entity Framework Code First migrations
Different way of mapping with EFCodeFirst
Different way of creating keys in EFCodeFirst

This post will also be part of this EF code first series. In this blog post we are going to learn how we can handle complex type in EF Code First. In our day to day operation we are having different kind of database tables where  there are multiple type of relationships  are defined like one-to-one, one-to-many and many-to-many. This all kind of relationship is handle by complex types.

Dependency Injection with ASP.NET MVC and Simple Injector


I have been learning SimpleInjector for few days and it’s just awesome.  I have already written two post about it(see below link) and this post will be third post about it. In this post we are going to learn how we can do Dependency Injection with ASP.NET MVC.

For those who are reading my posts about Simple Injector Following are two previous post I have written about Simple Injector. I highly recommend to read first two post so that you can be aware about how we can configure SimpleInjector container.

Dependency Injection with Simple Injector
Singleton Instance in Simple Injector

So let’s start with creating a ASP.NET MVC Project from Visual Studio.

Singleton Instance in SimpleInjector

Before some time I have written a blog post Dependency Injector with Simple Injector. This is a second blog post in same series. In this blog post we are going to learn How we can create a singleton Instance in Simple Injector.

What is is Singleton:
This is one of the Gang of Four creational pattern. Idea of behind the singleton pattern is to have only one instance of class of at anytime. This pattern ensures that a class will has only one instance of it and provides a global point of access to that instance.

I have already written a global blog post about that. You can find a basic example of Singleton pattern in C# from the following link.

Singleton Class in c#

How we can create Singleton Instance with SimpleInjector:
Here I’m going to create a console application with logger example. So let’s create via creating a new project like below.