Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EntityFramework Reverse POCO Code First Generate Separate Folders

EntityFramework Reverse POCO Code First Generator do the code generation like this default generated classes Can we create a separate folder for repository, interfaces, configurations and POCO entities by changing tt file. at the moment all the classes generate on root of the application. can we create classes with folders like this. expected way to generate

like image 352
Gayan Avatar asked Oct 23 '25 17:10

Gayan


1 Answers

Use these namespaces to specify where the different elements now live. These may even be in different assemblies. Please note this does not create the files in these locations, it only adds a using statement to say where they are.

If you have a subscription, I show how this works on the plural sight course

The way to do this is to add the "EntityFramework Reverse POCO Code First Generator" into each of these folders. Then set the .tt to only generate the relevant section you need by setting

 ElementsToGenerate = Elements.Poco; in your Entity folder,
 ElementsToGenerate = Elements.Context | Elements.UnitOfWork; in your Context folder,
 ElementsToGenerate = Elements.PocoConfiguration; in your Maps folder.
 PocoNamespace = "YourProject.Entities";
 ContextNamespace = "YourProject.Context";
 UnitOfWorkNamespace = "YourProject.Context";   
 PocoConfigurationNamespace = "YourProject.Maps";
like image 50
Simon Hughes Avatar answered Oct 26 '25 09:10

Simon Hughes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!