beyond dynamic code exection

  • Thread starter Thread starter George Meng
  • Start date Start date
G

George Meng

I got a tough question:

The backgroud for this question is:
I want to design an application works like a engine.
After release, we can still customize a form by adding a button, and source
code for the button. (This is done by the form itself, not by using VS.Net)
(button and source code should be a record in database, these information
should be retrieve from database when the form shows up)

What I want is:
I want the source code (comes from database) to access other controls which
has already been in the form. For example:
I want to read a item from a listbox (let's assume there is a listbox in
the form)
I want to add a item to a listbox
I want to change the property of a datagrid
.......

What I can to do:
1) add a button on the fly
2) load source code from database for this button's click event
3) complie code on the fly.

What I don't know:
I don't knwo how to reference the form in the new code.
I don't know how to reference the controls in the form.

Thanks for any suggestions.

George Meng
 
You need to know following
1) Look in to how you use the Csharp compiler will compile your code
2) Generate the code on fly....This is the bad task you will like to
do. I mean generate the CS files anbd every right from top to start

By the way i have just thought...must not be a good solution.

-------
Regards ,
C#, VB.NET , SQL SERVER , UML , DESIGN Patterns Interview question book
http://www.geocities.com/dotnetinterviews/
My Interview Blog
http://spaces.msn.com/members/dotnetinterviews/
 
I think they way to go is to define some simple plugin architecture for
you application, lets say a class with a method called "InitMyStuff"
that will receive an instance of your form, and then store the compiled
assembly bytes in the database, and then use reflection to load the
assembly, and call that method..
 
Back
Top