When I create Entities within the Graphical view of the edmx file. All my entity classes are bundled together in the Designer file. Is there a way to make Entity Framework to create classes in separate files allowing me to have more control over my entity classes?
+1
A:
If you are using Visual Studio 2010, click on the design surface of the EDM Designer and select Add Code Generation Item
, then select ADO.NET POCO Entity Generator
. This will create a T4 Template
file (*.tt
) that will be used to generate your POCO classes. Every class will have it's own file.
You have to be aware of the fact that every time you make changes to your EDM and save, those classes will be re-generated and the files will be re-written, so it's better not to make any changes to them directly. Those classes are partial
, so you can create new files and build up your classes without changing the initial files.
Yakimych
2010-07-31 16:49:22
Thank you Yakimych, very kind.
Beth
2010-07-31 17:13:36