是否可以使用 DLR 加载和执行 C# 代码片段?
我发现的有关 DLR 的大部分材料都与 IronPython 相关。 您可以使用 DLR 解析和执行 C# 吗? 如果是这样,是否存在开销会阻止您在拥有大约 30 个用户的 Web 服务器上尝试此操作?
更具体地说,我想在用户首次启动工作流程时编写工作流程对象的配置脚本。 根据全年变化的情况,工作流程可能会在不同的步骤开始,因此运行配置脚本似乎是处理变化的好方法。
The majority of material I have found regarding DLR is related to IronPython. Can you parse and execute C# using DLR? If so is there over head that would prevent you from attempting this on a web server with about 30 users?
More specifically I would like to script the configuration of my workflow objects when a user first initiates a workflow. Depending on conditions that change through out the year workflows may start at different steps, hence running configuration scripts seems like a good way to handle the variation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您确实在谈论 C#“编译器即服务”(在 this 的末尾) video),希望在 .NET 的 5.0 时间尺度内(尽管 Mono 现在有)。 目前, CSharpCodeProvider 是我们拥有的最好的(其工作原理很大程度上类似于“csc”)。
It sounds like you're really talking about the C# "compiler as a service" (at the end of this video), which will hopefully be in the 5.0 timescale for .NET (although Mono has it now). For now, CSharpCodeProvider is the best we have (which works largely like "csc").
尽管 Marc 为我提供了另一种选择,但我阅读了相关的 SO 问题 以及 C# 和 VB目前还不支持。
Although Marc offered an alternative for me, I read this related SO question and C# and VB are not supported as of yet.
您可能会发现这很相关...尽管它不在 DLR 本身上运行。
Mono 编译器即服务 (MCS)
它的优点是运行代码片段和不像 CodeDom 那样在每次编译时加载新的程序集。
You may find this relevant...though it doesn't run on the DLR itself.
Mono Compiler as a Service (MCS)
It has the advantage of running snippets and not loading a new assembly on every compile like CodeDom does.