ScriptsMatter (scripting for .NET) is .NET library delivering you the scripting solution for your projects, enabling you to provide for your customers a way to customize your applications and automate their tasks.
Key features of ScriptsMatter library:
- It is easy to use;
- Supports every language that is part of .NET infrastructure;
- Supports synchronous and asynchronous programming model with ability to cancel the execution of asynchronous operation;
- Executes code in separate AppDomain - does not affect your application domains.
- Allows you to define scripts entry point name, parameters and return type.
- Allows you to control scripting AppDomain parameters and security.
ScriptsMatter library exposes generic Engine class (helper actually) which provides static functions to work with scripting. The class can not be instantiated and inherited.
Engine class generic parameters are TScriptResult Type of return value of script's main function. This type must serializeble. TScriptingHost Type of variable that script's main function accepts. Must inherit MarshalByRefObject class.
This parameters allow you to specify the type you request your script to return and specify the type of variable that script's main function accepts. Second parameter is usefull if you want to pass context or service class instance to your scripts providing “hosting” for them.
Engine class may be used in 2 ways to deal with scripting in your applications.
First way is synchronouse. Engine class exposes static function named CompileAndRun for synchronouse work.
Second way is asynchronouse. Class exposes static functions: BeginCompileAndRun, EndCompileAndRun, AbortCompileAndRun for asynchronouse work.
By default, the helper will try to find script's entry point that has a signature like: C#:
public static TScriptResult ScriptingMainClass::Main(TScriptingHost host)
Visual Basic:
Public Shared Function ScriptingMainClass::Main(Host As TScriptingHost) As TScriptResult
You can change script's entry point class name and method name supplying appropriate parameters to CompileAndRun, BeginCompileandRun functions.
For an example of ScriptsMatter library usage please see ScriptsMatter Getting Started HOWTO.
|