我该如何开始设计和实施我的.NET应用程序的脚本接口? [英] How do I get started designing and implementing a script interface for my .NET application?

查看:205
本文介绍了我该如何开始设计和实施我的.NET应用程序的脚本接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何开始设计和实施一个脚本接口,为我的.net应用程序?

How do I get started designing and implementing a script interface for my .NET application?

VSTA (在.NET相当于< A HREF =htt​​p://en.wikipedia.org/wiki/Visual_Basic_for_Applications> VBA 获得的 COM ),但据我了解,我将不得不支付许可费,每次安装我的应用程序。它是一个开源 应用程序,这是不行的。

There is VSTA (the .NET equivalent of VBA for COM), but as far as I understand I would have to pay a license fee for every installation of my application. It is an open source application so this will not work.

还有如间preters嵌入(IronPython的?),但我不明白这将允许公开的对象模型(见下文),外部(或内部)的脚本。

There is also e.g. the embedding of interpreters (IronPython?), but I don't understand how this would allow exposing an "object model" (see below) to external (or internal) scripts.

子问题:

  • 什么是.NET脚本接口的故事?是它在某种程度上容易做到这一点。NET?
  • 例如。可在我的应用程序及其包含的对象一些.NET对象被宣布为从外部访问在运行时?
  • 如何 外部脚本访问我的应用程序(通过对象模型)?

背景:

我曾经设计并实现了一个相当复杂的脚本接口,用于收购从的质谱仪(Mac OS中,系统7 )和以后的Windows应用程序一个COM接口。

I have once designed and implemented a fairly involved script interface for a Macintosh application for acquisition and analysis of data from a mass spectrometer (Mac OS, System 7) and later a COM interface for a Windows application.

两人都设计有一个对象模型和类(可以有属性)。这些都是超载的话,但 在一个脚本接口上下文对象模型实质上是一个容纳hiarchy 具体的类的对象。类具有属性,包含的对象列表,不仅是数据,但可以有动词以及(操作/方法)。例如。在Macintosh的情况下定义 应用对象可以包含一个收购对象,对仪器和 fireLater 动词连用电压特性 - 所有从外部脚本见过

Both were designed with an "object model" and classes (that can have properties). These are overloaded words, but in a scripting interface context object model is essentially a containment hiarchy of objects of specific classes. Classes have properties, lists of contained objects and is not only data but can have verbs as well (actions/methods). E.g. in the Macintosh case the defined application object can contain an acquisition object that have properties for voltages used in the instrument and a fireLater verb - all as seen from the external script.

请注意,在这两种情况下用于实现应用程序的编程语言中的类/对象无关的脚本对象模型。为Macintosh情况下用于实现脚本接口的机制是由苹果定​​义的。此外,还有苹果公司对如何设计对象模型中定义了一些标准。比如在类标准名称某些共同的属性。

Note that in both cases the classes/objects in the programming language used to implement the application had nothing to do with the scripting object model. For the Macintosh case the mechanisms used to implement the scripting interface was defined by Apple. There were also some standards defined by Apple on how to design the object model. For instance standardised names for certain common properties in classes.

或者像在Microsoft Office应用程序暴露的COM接口,其中应用程序对象可以被用于添加到文件清单(以创建文档的图形用户界面重新presentation的副作用)。

Or like in the COM interfaces exposed in Microsoft Office applications, where the application object can be used to add to its list of documents (with the side effect of creating the GUI representation of a document).

外部脚本可以在容器中创建新的对象和浏览hiarchy在任何给定时间的内容。在Macintosh情况下,脚本可以写在如 AppleScript的前沿

External scripts can create new objects in a container and navigate through the content of the hiarchy at any given time. In the Macintosh case scripts could be written in e.g. AppleScript or Frontier.

在Macintosh上的脚本接口的实现是非常复杂的。 在 Metroworks C ++类库支持它(这个名字逃脱我现在)使它更简单。

On the Macintosh the implementation of a scripting interface was very complicated. Support for it in Metroworks' C++ class library (the name escapes me right now) made it much simpler.

推荐答案

IronRuby和IronPython的都非常工整,适合这个(但对方回答说,如果你有更多的基础设施类的东西的PowerShell可适当)。

IronRuby and IronPython are very neat and appropriate for this (but as the other answer says, PowerShell may be appropriate if you have a more infrastructure-type thing).

编辑:其他的想法,使内部脚本是

Other ideas for enabling internal scripting are

  • 在使用的Windows Workflow Foundation(暴露活动,它和/或托管工作流实例)
  • 使用 Spring.NET的前pression语言(这是简洁,易于doc和学习,但令人惊讶的强大)
  • using Windows Workflow Foundation (exposing activities to it and/or hosting instances of workflows)
  • using Spring.NET's Expression Language (which is terse, easy to doc and learn but surprisingly powerful)

编辑2 2011年6月:IronJS也可能是一个合适的人选,有一个Hanselminutes的会谈它通

EDIT 2 June 2011: IronJS may also be a suitable candidate, there's a Hanselminutes that talks it thru.

这篇关于我该如何开始设计和实施我的.NET应用程序的脚本接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆