开发者

Creating WCF Services using Dynamic Languages and DLR

I was curious how anyone would go about creating WCF based services using a dynamic language like IronPython or IronRuby. These languages do not have the c开发者_高级运维oncept of interfaces. How would someone define service contracts? Would we need to rely on static languages for such kind of tasks? I am a big fan of Python in particular and would like to know if this can be done at this point.


I have done some experiments - see my experiences on my blog.

The good news is WCF service can be fully written in IronPython. The bad news is such WCF service does not work in IIS because you cannot use compiled IronPython code from C# or VB directly.


IronPython has a new feature in 2.6 to create normal .NET classes using the Python class definition machinery. The new feature is enabled by overriding clrtype on a metaclass. You can then declare a class with a bunch of decorators and the metaclass creates a new .NET type. As a sample we have the set of metaclasses which can be used (or customized) over on the IronPython CodePlex site for the 2.6.1 release.

I haven't tried it w/ WCF in particular but it does work in other cases when you need to use a static type. There are some cases where it won't work - particularly if the framework needs to do Type.GetType(typeName).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜