Too many dynamic assemblies

I am trying to use the Razor view engine as a generic template engine supported by the database.
http://razorengine.codeplex.com/ The problem is that a new dynamic assembly is created and loaded for each template compilation. Since there is no way to unload the assembly from the current application and not use a separate application for the template system (using anonymous types), these assemblies will continue to accumulate until the appdomain is destroyed. The templates themselves will change on a regular basis and, as such, will lead to more recompilations.

The question is, will these dynamic assemblies (potentially thousands) affect application performance? Or, alternatively, is there a better way to do this?

+7
source share
1 answer

All in all, with many small builds uploaded to AppDomain, there shouldn't be too much to worry about. The only general statement anyone can make about this is to measure the actual performance of the application in the appropriate scenarios, and then see if that matters.

ASP.NET has some automatic application lifecycle management that will process AppDomain after certain events. For example, if the application has too many recompilations, ASP.NET will automatically restart the application. This means that all previously loaded assemblies will be cleared and you will start from scratch.

See MSDN for more information: http://msdn.microsoft.com/en-us/library/s10awwz0.aspx

numRecompilesBeforeAppRestart

Optional Int32 attribute.

Determines the number of dynamic resource recompilations that may occur before the application restarts. This attribute is supported at the global and application level, but not at the directory level.

Note

ASP.NET increments the NumRecompilesBeforeAppRestart property every time the assembly is invalid and cannot be removed.

The default value is 15.

+1
source

All Articles