Friday, June 18, 2010

Jetfire objects now Support .net DLR

Jetfire provides .net programmers many features not found in the standard languages.  Mixing Jetfire code and .net code has always been a straight forward task.  Now, with Jetfire Dynamic Language Runtime (DLR) objects that task has been made much easier.  Using Visual Studio 2010 Jetfire objects can now be accessed directly from .net languages.

click to enlargeDLR allows .net programmers to very easily use Jetfire objects in their applications as shown the following example:

Here is a simple Jetfire program.

namespace DlrExample
{
    public workflow MyFlow
    {
        public string MyString{get; set;}
        public string MyAction(){ return this.MyString;}
        public string MyAction(string s){return s;}
    }
}

To work with Jetfire objects the following C# code can be used.

dynamic myFlow = nexus.New<Workflow>("DlrExample.MyFlow");
//
// Access the Workflow's properties and methods
//
myFlow.MyString = "some string";
Assert.AreEqual("some string", (string)myFlow.MyString);
Assert.AreEqual("some string", (string)myFlow.MyAction());
Assert.AreEqual("some other string", (string)myFlow.MyAction("some other string"));

For a complete listing search for ‘TjDlrTest.cs’ in the codeplex download.
Also see
Dynamic Method Call Simplifies C# Code

Jetfire wiki article : Application Interface



0 comments: