AspDotNetAtoms.com provides daily updates on ASP.NET Tutorials, Programming Resources, .NET Articles, Authors and more.

Categories

Recent Posts

ASP.NET 2.0 - Safely Compile And Execute Source Code Dynamically : Robbe Morris

Tuesday, August 26 2008

You've probably run across all sorts of code samples for dynamically compiling and running source code in .NET 2.0. Fortunately, this is fairly easy in .NET. What I haven't yet seen covered is a safe way to do this in an ASP.NET environment. The biggest problem you run into is that each time you compile your code (even if you use the exact same attributes and settings) is that a new duplicate assembly is loaded into memory. So, you could easily wind up with thousands and thousands of duplicate assemblies floating around in memory on your server because there is no facility in .NET 2.0 to unload an assembly from memory. I am currently working on an application that permits the creation and implementation of business rules at runtime to perform such tasks as data processing, validation, navigation, and calculation rules. In fact, we support user specific compiled rules in some rare instances. The requirements are far too complex to attempt to make these rules entirely database driven. In the end, actual C# compiled code is required...

Read More:
ASP.NET 2.0 - Safely Compile And Execute Source Code Dynamically : Robbe Morris
Also See:
How to make any WebService Method "Timeout"-able : Peter Bromberg
Support Voice: Using Virtual Path Providers : Parag Agarwal
Zero Config Dependency Injection : Castle Windsor Trunk Edition :
Basic Reporting Part 3: Programmatically Setting the ObjectDataSource's Parameter Values : Scott Mitchell
Testing Web Sites with HttpWebRequest : Eric Smith

Post your comment

Comment