subsonic / SubSonic-3.0-Templates

T4 Template Project for the peeps
http://subsonic.github.io/
105 stars 46 forks source link

Feature request [commit ready to pull]: Flexible namespace generation #17

Open TheDistantSea opened 15 years ago

TheDistantSea commented 15 years ago

I 'm currently using SS3 in a project where we 'd like, for the time being, to generate code from both the AR and LINQ. I hacked the templates a bit to get them to use a common Settings.ttinclude to avoid duplication.

The problem was that AR and LINQ classes needed to go to separate namespaces, e.g. "MyProject.Data.AR" and "MyProject.Data.LINQ". Therefore I patched the templates to not use const string Namespace directly, and instead go through a GeneratedNamespace() method which would add the appropriate suffix depending on the template being compiled.

You might want to pull the commit from http://github.com/defacer/SubSonic-3.0-Templates/commit/c6153520ff2b4157bcf9396d6e89f2a78ab95fa3, it's added flexibility and there's no price to be paid for it. Would make my life easier too. :-)

Thanks!