I have a DLL which provides an entry point to an ASP.MVC application. Let’s call this Primary.DLL. In Primary.DLL, there are LINQ-to-SQL data context and other classes defined. Somewhere in Application_Start(), Assembly.Load() is called to load Secondary.DLL. Secondary is NOT referenced in Primary.DLL’s project file. But Primary is referenced in the project file of Secondary.DLL because the LINQ-to-SQL data context and other classes mentioned above are used in Secondary.
Would this create a circular dependency problem? Would there be any problem with this kind of design?
We do this all of the time with customer-specific customization DLLs. We use the same functionality in web applications, services, and desktop exes.
The customer DLLs reference the base project DLLs so that they can inherit from various classes and implement interfaces. To do so, they must have a reference to the base dll.
At application startup (
global.asax Application_Startor an exe’s initialization routine), we load any discovered customization DLLs throughAssembly.Loadand it definitely does not create a cross-reference.