I am going to dedicate next few posts to understanding and using Entity Framework  Code First approach.

If you are new to EF Code First then read on…

If your start writing a data model using code first  approach. At some point after designing your model classes, you have to create Context.  Context coordinates Entity Framework functionality for a given data model. You create this class by deriving from the System.Data.Entity.DbContext class.

If you have not installed Entity Framework before working with DbContext then I must tell you that you need to reference EntityFramework.dll to access DbContext class. And easiest way to do that is by using the Library Package Manager if you have it (it installs automatically with MVC 3.0).

From within your project in Visual Studio 2010,

Go to Tools > Library Package Manager > Package Manager Console.

In the console, after the “PM>” prompt,


install-package entityframework

And Voila!!! Code Compiles…