Using the scripting engine in. Net

Source: Internet
Author: User
Tags net scripting engine
Script

Using a scripting engine in your application can greatly enhance the flexibility and scalability of your program, similar to MS Office and VS. NET's macro function. Microsoft. NET Framework, the script engine framework is defined in Microsoft.vsa.dll, while Microsoft.Visualbase.vsa.dll defines the scripting engine that implements VBA. Using these two DLLs, you can define your own vba.net scripting engine.

Some framework interfaces are defined in Microsoft.vsa.dll, where the more important interfaces include
IVsaEngine for scripting engine interfaces, all scripting engines use this interface
Ivsasite script engine Communication interface, script engine accepts this interface to post some information
Ivsaitem Project for scripting engine-related resources
Ivsacodeitem for scripting code modules
Ivsarefrenceitem external Reference object used for the scripting engine
Ivsaglobalitem the Global object module used for the scripting engine

Use procedures typically instantiate a script engine, pass the Ivsasite object to the script engine object, and then add references, code text, and global objects using the CreateItem method of the engine's items. Then call the compile method to compile the script engine and use Run to start the engine.

After the script engine is started, a assembly assembly is dynamically generated and loaded according to the script code in the current application domain, using ivsaengine.assembly to access dynamically generated assemblies.

Microsoft.VisualBase.vsa.dll implements these interfaces and implements a scripting engine based on the vba.net syntax.
The main object is Vsaengine

This program provides a C # written demo program, using Microsoft. NET Framework 1.1, the demo program provides a general-purpose module that uses the scripting engine, which makes it easy to use the VBA scripting engine to extend your application.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.