You want to use VBCodeProvider. Regarding your appdomain unloading assemblies - simply have your appdomain recycle every X hours via IIS. Pick a time of day with no load and have it happen then. Its the only real solution, even if your app is 24x7. If it really is business critical, you need to switch to a DR server whilst your main server is recycling.
Just be careful when using this kind of code - you REALLY want to check the input before running it! On Sun, Oct 17, 2010 at 9:22 PM, Pat <[email protected]> wrote: > Visual Basic 2010 > > Imagine an application that has a list of items available on the left. > These are just variables (ints, objects, doubles, any of the usual > programming elements). This list is produced at run time based on the > actual programmatic items available. > > In the rest of the form there is a multi-line text field for the user > to enter visual basic code. The code has access to all the elements on > the left. Since all the elements on the left are already declared, > something like this would be possible: > > (the "|" character is to divide the list from the code area) > _____________________________________________ > x | x = 3 > y | y = x + otherVar > otherVar | soneClass.someVar = y > someClass | > ___________|__________________________________ > > So the list is on the left, and the code the user entered is on the > right. I've seen this done with a Java base and BeanShell, but I am > using Visual Basic. I know this example above is simple, but you get > the idea. I could use an expandable treeview on the left, for example, > to illuminate the elements of classes, tooltips for variable types, > etc. > > I've looked at Dynamic Code, and beside being overkill it is not a VB > solution. > > Am I thinking of something that isn't possible? Of course not. But I > notice a few things in reading how app domains load assemblies at run > time that make my app queezy... App domains don't, as far as I can > tell, unload gathered assemblies. Compiling and loading assemblies- > even if they are the same name as any previous, will result in an > incremental increase in memory used. > > The whole reason I need a dynamic compile is that the app is a 24/7 > app that cannot be taken down to reload, nor give my users the source > code and ask that they recompile. So most of the code never changes, > but the user can change the business logic any time they want-but > without a reboot, restart, or memory problem. > > TIA! > > pat > :) >
