|
Thank you for the response. This works indeed. I have a suggestion for improving the template's support for this scenario.
If the classes will live in different assemblies, they may (will likely...) live in different namespaces also. I would suggest modifying as follows (which would not break existing uses):
- Define two new string properties on the EntityGenerator class:
- DomainNamespaceName: to enter the namespace for the domain classes (model.cs)
- DalNamespaceName to enter the namespace for the data access classes (all other files)
- Both initialized to string.Empty.
- Modify Context.cs.ttinclude, Context.Extensions.cs.ttinclude, FakeContext.cs.ttinclude and IContext.cs.ttinclude (23) to read
<#=EfUtils.WriteBeginNamespace(code.EscapeNamespace(EntityGenerator.NamespaceName + DalNamespaceName))#>
- Modify Model.cs.ttinclude line 24 to read
<#=EfUtils.WriteBeginNamespace(code.EscapeNamespace(EntityGenerator.NamespaceName + EntityGenerator.DomainNamespaceName))#>
That way, if people put their classes in one assembly/namespace, no changes are required. For people who want to put their model in a different namespace (the NamespaceName could be completely empty if required), it is also possible.
Finally, perhaps adding a way to choose not to link .cs by default could be handy also.
Thanks for the efforts on this project!
Sven.
|