building a "scriptable" application
During development of a new application, I was wondering how the most flexible solution of a dynamic, let's say ‘scriptable’, system would look like.
In general, I would need a file in plain te开发者_如何学Pythonxt (e.g. TXT or XML) wherein I define a trigger (in my example a hex string) and a corresponding action (open a window, execute a SQL transaction, …). I should be able to add new entries without recompiling the whole application.
As you see, it's not really scriptable this way, but I need a solution to define what happens with which input.
Has anyone got some experience with this?
There are various scripting languages you can use inside your .NET application; IronPython being one obvious example, but others are available - javascript for example (talking to your .NET objects; not in a browser). One of these might have some application here?
If you have only simple program flow you can use Windows Workflow Foundation Rules Engine.
Features
- Inlcuded in dotnet3.0 runtime, no extra costs
- RuleSetDialog can be integrated into your code to edit rules including intellisense
- persistable as xml-files.
- ruleengine can evaluate expressions and can perform actions
See also
A quick and dirty Rules Engine using Windows Workflow Part1 and Part2
I first found this topic when reading the german languaged magazine dotnetpro 10/2010 on page 30 "Die Rule-Engine aus .NET ohne Workflow benutzen"
Well you can embed a .NET language like IronPython or possibly Boo
精彩评论