I modified the main .tt script in order to have the code generated in separate files and distinct kind of elements separated in folders as described here:
// Elements to generate ***************************************************************************************************************
// Add the elements that should be generated when the template is executed.
// Multiple projects can now be used that separate the different concerns.
ElementsToGenerate = Elements.Poco | Elements.Context | Elements.UnitOfWork | Elements.PocoConfiguration | Elements.StoredProcedures;
// 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.
// I show how this works on the video from 26:08 onwards.
// 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";
// You also need to set the following to the namespace where they now live:
PocoNamespace = "";
ContextNamespace = "";
UnitOfWorkNamespace = "";
PocoConfigurationNamespace = "";
So far it works pretty well, but the stored procedures only get generated if I include them in the "Context" folder. It would be nice to have them in another folder called "StoredProcs", together with the return models. It looks like to have them in another folder requires two (possibly clashing) MyDBContext files.
Is it posible to do this ?? Is it possible to have the stored proc calls each in a separate class file ??
Thanks,
Daniel
Comments: I have changed the stored proc generation to be a boolean value now. Which makes much more sense.