I have 3 projects in my solution, 2 web and 1 class library which has a number of extension methods. When my extension methods take a dependency on T4MVC extension methods I must move that code into a class within App_Code of each
web project. This results in not being able to share extensions across multiple web apps without having to copy code between web projects.
From what I can tell it appears T4MVC creates code which could be categorized as dynamic and static - where dynamic is specific to the web project itself and static is the same code generated every time for ever web project. It is this static code
which I would like to lift out of the T4MVC generated code and place into my class library.
One initial idea I had was to have the T4MVC template generate the dynamic and static code in 2 partial classes rather than just one. Then a setting could be added when someone such as myself wants to store the static in a shared library. The setting
would accept a reference namespace in the external DLL and #IF EXTERNAL...#endif the static partial class so all references go to the external DLL. A developer could then pick up the #IFed out code and copy that into the external DLL.
Thoughts? Would this even work -- not sure just throwing it out there so be kind to my brainstorming here.