Wednesday, March 04, 2009

Make your .NET application extendible using DLR : IronPython

Krishna Vangapandu has posted a blog entry on using the Dynamic Language Runtime hosting API to make a .NET (C#) application extendable:
There are different ways to define this – extensibility in applications, adding macro capability to your applications, providing add-in like facility in .NET applications. For me, all of this mean the same – ability to modify your application (data or the UI) at runtime by means of scripts. Like I mentioned in the previous post, I wanted to dig into DLR or Dynamic Language Runtime which is basically a framework that could be used to provide dynamic languages support on the .NET platform. Even though I am not much interested in giving up C# for dynamic languages like Python or Ruby, I was very much keen to add facility to make my applications extensible using these languages (to tell you the truth, I am more comfortable with JavaScript or Groovy than any of these).

Anyway, I worked on an application which displays a datagrid and one could modify that the data being displayed using Python script at runtime. The way I did it was to host IronPython inside C# using the DLR framework.

The article would be a detailed step by step procedure on each and every piece of code that has been written so that it helps the readers get familiar with the following
  • Using WPF Datagrid and databinding. Also shows Dependency Properties.
  • How to refresh WPF Datagrid items.
  • Hosting IronPython inside C# applications.
  • Passing data to and fro between C# and IronPython script.
If you're interesting in embedding IronPython in .NET applications, for making your application extensible or allowing user scripting, then you may find these articles useful: Embedding IronPython Articles. Of course the best reference on this subject is IronPython in Action.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.