开发者

Want to script a C# application

I need to run some validation tests on our c# client-server configuration. Is there a dynamic script language that my client application could run, that would have full access to all of its C# classes and asssemblies?

Somet开发者_Go百科hing like beanshell for java: http://www.beanshell.org/intro.html

Thanks!


I think your best option would be Windows Powershell.


How about IronPython?


I recommend trying out Mono's Evaluator class, which has methods for evaluating single statements or code blocks (which are returned as delegates).


If your application is an ASP.NET application, you can effectively script it in C# using the App_Code folder. In the application's folder, create a folder called App_Code and drop a .cs file in there. Any changes to this file will be dynamically compiled by the ASP.NET compiler and result in a restart of the application. This code will have access to all of the assemblies in your app.

To get this code to execute, you can hook up to an application event or you can write a piece of code in your application to dynamically discover and call it, for example by implementing a known interface with an App_Code class and doing an assembly scan for it when your app starts.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜