简体   繁体   中英

Entity Framework generating separate classes

I was using previous versions of entity framework and it was generating just one file for all classes . But I just upgraded to Visual Studio 2012 and now it generates a separate class files for each table . How do I change that ? I don't want 100s of class files and want them to be combined in one file/namespace .

You have to remove your T4 Templates (the *.tt files) an all the generate classes. Then open the *.edmx file. In the property window search for Code Generation Strategy and set it from None to Default .
Now the old template with the ObjectContext will be generatet. But I recommend using the T4 Template and its generated POCO classes. Thei're much cleaner and you can change the T4 template if needed.

See https://stackoverflow.com/a/13614390/2743414

And How can I modify the default code generation strategy for edmx?

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