Generate POCO classes in different project to the project with Entity Framework model
Posted
by Max
on Stack Overflow
See other posts from Stack Overflow
or by Max
Published on 2010-03-17T18:36:44Z
Indexed on
2010/03/17
18:41 UTC
Read the original article
Hit count: 661
I'm trying to use the Repository Pattern with EF4 using VS2010.
To this end I am using POCO code generation by right clicking on the entity model designer and clicking Add code generation item. I then select the POCO template and get my classes.
What I would like to be able to do is have my solution structured into separate projects for Entity (POCO) classes and another project for the entity model and repository code.
This means that my MVC project could use the POCO classes for strongly typed views etc and not have to know about the repository or have to have a reference to it.
To plug it all together I will have another separate project with interfaces and use IoC.
Sounds good in my head I just don't know how to generate the classes into their own project! I can copy them and then change the namespaces on them but I wanted to avoid manual work whenever I change the schema in the db and want to update my model.
Thanks
© Stack Overflow or respective owner