Best practices Entity Framework 4.0 with MVC?http://forums.asp.net/t/1732204.aspx/1?Best+practices+Entity+Framework+4+0+with+MVC+Thu, 20 Oct 2011 17:31:26 -040017322044647021http://forums.asp.net/p/1732204/4647021.aspx/1?Best+practices+Entity+Framework+4+0+with+MVC+Best practices Entity Framework 4.0 with MVC? <p>Hi,</p> <p>I am writing an MVC application, and thinking of to use Entity Framework.</p> <p>I have read lots of blogs about EF 4, but one thing that bothers me is the seperation.</p> <p>I think, in EF, the entities (types) and its mapping with data source (i.e. Stored Proc/ table) should be within the same class library project. If that's the case, then my MVC application will have to use direct reference to that data library. Which I feel is a bad design.</p> <p>The ideal design what I feel is that MVC will refer to a class that will have only types (entities), and NOT their mapping with the database interaction code. That is why, I need seperation of these into 2 different layers.&nbsp;</p> <p>My WCF service will reference both of them, but MVC application will reference only the class library having Entities defined.</p> <p>Is this possible anyway?</p> <p></p> <p>Thanks</p> <p>Nirman</p> 2011-10-20T11:35:13-04:004647581http://forums.asp.net/p/1732204/4647581.aspx/1?Re+Best+practices+Entity+Framework+4+0+with+MVC+Re: Best practices Entity Framework 4.0 with MVC? <p>Not sure if I folow you, but i tell you how i set things ourt if it helps</p> <p>MVC Website</p> <p>&nbsp; ViewModels</p> <p>&nbsp;&nbsp;&nbsp; ClassLibrary (Business objects)</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClassLibrary (EF)</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SQL Server</p> <p>I have business objects for each entity that handles all comunications with the EF layer using linq<br> The view models handle complex models, but if I want just a single entity in my model, i will go straight to the business object layer</p> <p>&nbsp;</p> 2011-10-20T17:31:26-04:00