ECMA-CLI(Mono)/.Net CLR Runtime Hosting
HO-S-10 Integrating Common Language Runtime Objects with Virtuoso
Using C# Objects to extend Virtuoso via User Defined Types using CREATE LIBRARY/ASSEMBLY syntax.
Overview
The HO-S-10 sample is very similar to HO-S-2. The difference is using syntax CREATE LIBRARY. The statement imports assembly to internal Virtuoso table and imports types from it. After this the assembly can be removed from physical path and next time will be read from the table. The "DROP LIBRARY" removes assembly from table and drops imported types.
Prerequisites
The following prerequisites ensure the usability of these tutorial 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 following 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 with Virtuoso. It also copies the Point_ho_s_10.dll file 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_10.sql" link to see the code behind this step
- Click on the "Run" links to actually experience the demo
Demo Breakdown
- "ho_s_10.sql" performs the following steps
- Registers the "Point" classes with Virtuoso. Click on the "Point_ho_s_10.cs" links to see the C# source code of these classes
- Creates the Object-Relational table "Supplier_ho_s_10" that includes a column named "Location" that is of Type "Point" (a UDT)
- Populates table with data
- Using syntax: CREATE LIBRARY/ASSEMBLY "myPoint" as "assembly" WITH PERMISSION_SET = SAFE WITH AUTOREGISTER is simular to: CREATE LIBRARY/ASSEMBLY "myPoint" as "assembly"; and import_clr ('myPoint', NULL);
- "vsp1.vsp" is a variation of HO-S-2 (vsp3.vsp), with the column "location" being used to access and conditionally test the values of data member "x" (shown in "Point.cs" as 0).
In order to run this example you need Virtuoso Universal Server for Windows with .NET CLR Hosting.
| View the source | Action |
|---|---|
| 1. ho_s_10.sql | Set the initial state |
| 2. Point_ho_s_10.cs | |
| 3. vsp1.vsp | Run |
OpenLink Home
Technical Support