Is it possible to load and execute C# snippets usi

2020-06-03 07:14发布

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.

3条回答
够拽才男人
2楼-- · 2020-06-03 07:46

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").

查看更多
再贱就再见
3楼-- · 2020-06-03 07:47

Although Marc offered an alternative for me, I read this related SO question and C# and VB are not supported as of yet.

查看更多
女痞
4楼-- · 2020-06-03 08:00

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.

查看更多
登录 后发表回答