ECMA-CLI(Mono)/.Net CLR Runtime Hosting
HO-S-11 Integrating Common Language Runtime Objects with Virtuoso
Using Restrictions for C# Imported types.
Overview
This tutorial demonstrates the options PERMISSION_SET = SAFE and PERMISSION_SET = UNRESTRICTED on CREATE LIBRARY / ASSEMBLY.
Prerequisites
The following prerequisites ensure the usability of these demos on Windows
- Windows
- .NET Runtime and Frameworks
- .Net Runtime and Framework SDK (if you seek to write your own Objects for integration with Virtuoso)
- Virtuoso Universal Server for Windows with .NET CLR Hosting
Tutorial Example
The tutorial shows how C# classes are used to create User Defined Types (UDTs) in Virtuoso.
Please follow the steps below to maximize the value of this tutorial:
- Click on the "Set Initial State" link which registers the two C# classes within Virtuoso. It also copies the restricted.dll and unrestricted.dll files to "tmp" directory in the server root. Note that the directory must exists, must be writeable for the user running virtuoso and must be in the DirsAllowed parameter in Virtuoso ini file. Click on the "ho_s_11.sql" link to examine the code behind this step.
- Click on the "Run" links to execute the demo.
Demo Breakdown
- "ho_s_11.sql" performs the following steps
- Registers the "Rest" and "UnRest" classes with Virtuoso. Click on the "restricted.cs" and "unrestricted.cs" links to see the C# source code of these classes.
- The "unrestricted.vsp" is shows classes that try to access File system and system variables. The "restricted.vsp", uses the same clases, but cannot complete the execution sucessfully because the assembly is imported with PERMISSION_SET = SAFE. The sample shows the error returned upon executing the classes.
In order to run this example you need Virtuoso Universal Server for Windows with .NET CLR Hosting.
| View the source | Action |
|---|---|
| 1. ho_s_11.sql | Set the initial state |
| 2. restricted.cs | |
| 3. restricted.vsp | Run |
| 4. unrestricted.cs | |
| 5. unrestricted.vsp | Run |
OpenLink Home
Technical Support