Reputation: 17744
I'm using new Entity Framework 4.1 Model first approach that makes use of T4 templates to generate classes from visual model.
Can I configure that T4 templates to create POCO classes and Context classes (or at generally whatever they generate) in another project?
Please note that I don't want to move T4 template (file with .tt) to another project and then just change the template to EDMX file in persistence project. I want it to really generate that classes in another project then the location of template. Is that possible ?
Thank you for answers
Notes: this is no duplicate of question Generate POCO classes in different project to the project with Entity Framework model as author there wanted just what I don't: move the whole template together with classes generated.
I fully understand that moving the whole template will not mean that the other project will become persistence aware. Still, I have my reasons why I don't want it in the same project with POCO classes.
Upvotes: 7
Views: 9932
Reputation: 104999
Whenever I use shared T4 templates I:
If you're using provided templates you will have to modify them a bit to make this work, because they will have to reference EDMX file on a different location than default. You can as well provide this path as a local variable that you override in your per-project template so it will use the overridden path instead of default defined in the ttinclude file.
Upvotes: 2