简体   繁体   中英

Multiple Projects in a solution - Entity Framework and ASP.Net MVC 4

For a school project I am building an application that has to be splitted in multiple projects.

The projects that will be made are class libraries, a wcf service and a asp.net MVC4 application.

The class libraries will be a state library, a stateless library and a datalogic library.

Ideally entity framework should be in the datalogic library, the generated models should be placed in the state library and the classes in stateless contain static methods to save those models.

However I can't seem to get the models generated by Entity Framework (v5) to another class library (State). Is there some way to do this? Or do I think wrong, should I use another architecture?

This problem is solved: Entity Framework 5 and Visual Studio 2012 POCO Classes in Different Project

Advice on architecture is still welcome:

I am willing to change this structure, if mine is proven wrong or less efficient as the one adviced.

(Other information I may need to provide is that the WCF service will pass through the methods of the stateless library and the ASP.Net MVC4 application is using those methods to get the models and some controller functionality)

(So you can mark an answer)

Are you using the EF DbContext POCO Generator?

It's then reasonably straight forward to have the .edmx context and poco models in different assemblies - msdn.microsoft.com/en-US/data/jj206878

As you discovered - this post on Entity Framework 5 and Visual Studio 2012 POCO Classes in Different Project explains the procedure well.

Julie Lerman also has downloadable solutions from her books & courses that show POCo T4 templates and lots of other good practices

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM