C # executing a string as code ... is it worth the effort?

Here is the story:

I am making a winforms C # application to facilitate the identification of quotation hiring equipment.

In it, I have List<T>out of ~ 1,500 shares.

These elements have a property called AutospecQtythat has an accessory getthat needs to execute some code specific to each element. This code will refer to various other items in the list.

So, for example, one element (let it call it Item0001) has this getaccessor, which may need to execute code that might look something like this:

[some code to get the following items from the list here]

if(Item0002.Value + Item0003.Value > Item0004.Value)
{ return Item0002.Value }
else
{ return Item0004.Value }

That all is well and good, but these bits of code are likely to change weekly, so I try to avoid frequent redistribution. In addition, each element can (will) have a completely different code. Some will request a list, some of them will perform some mathematical functions with long asses, some of them will be a simple addition, as indicated above ... some will depend on variables not contained in the list.

What I would like to do is save the code for each item in a table in my database, and then when the application starts just pulling out the appropriate code and pasting it into the list, ready to be executed when the time comes.

, , , / - ( ), , .

, :

  • / , ?
  • 1 = false ( , ), , ( )?
  • (, ) autospec DLL , , DLL ?

, - , . - , , ?

? , : P

, , autospec . ( - ), , , , .

, .

+5
5

:

1) , ?

2) MEF , DLL, ?

3) ( , A + B + C + D > E + F + G + H = > J K), , .

4) .NET 4 , .

+1

, .

wikipedia:

- , -, .

+1

- MEF, DLL, , , .

, ( ) .

+1

, , , . DSL .

, .:-) , .

+1

Perhaps your program will compile your rules at runtime into a class that acts like a plugin with CSharpCodeProvider.

See Compiling Runtime Code for an example of how to do this.

0
source

All Articles