I like to use EntityFramework to quickly create sites on the ASP.NET MVC. I usually use the “databae first” principle and DbContext.
I create a global layer that interacts with DbContext and returns, changes, deletes and adds entries. Something like this:
GetLastPosts (int count)
FindPostById (int id)
RemovePost (int id)
...
All in one class. Usually, it becomes very large and I do not like it. Please tell me about your experience of usage EntityFramework.
I usually use the repository pattern with the unit of work pattern:
Here is the best tutorial that I found. It shows how to create both patterns in asp.net, however, the implementation will be the same in any app. It doesn’t have to be asp.net
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application
And a more general example:
http://msdn.microsoft.com/en-us/library/ff649690.aspx