Author : MD TAREQ HASSAN
Separating T4 Generated Domain Classes
- In Visual Studio Create a new project
- In File Explorer Move
[model].tt
to the new project folder - Back in Visual Studio, Include
[model].tt
in Domain Classes project - Delete
[model].tt
from data project - Modify
[model].tt
to point to correct EDMX path - Add a reference of domain classes project to data project (Containing DbContext)
- Modify
[context].tt
to use new namespace - After each model modification, force code generation
Separating T4 Generated Domain Classes sreenshots
Step-1
Step-2
Step-3
Step-4
Step-5
Step-6
Step-7
Step-8
Step-9
Step-10
Step-11
Step-12
Step-13
Step-14
Step-15
Step-16
Step-17
Step-18
Step-19
Step-20
Reflecting changes to domain classes
Since we separated domain classes from data project, any change in conceptual model would not automatically be reflected into domain classes. We have to manually update domain classes every time we change conceptual model
Step-1
Step-2
Step-3
Step-4
Step-5