This function automatically creates the SQL Type wrappers based on the CLR Reflection API.
Here is a simple C# program that we can import and use with Virtuoso. This example requires that you are running Virtuoso with CLR support.
Using a text editor create a C# source file in the server root directory called sanity.cs, with the following contents:
using System; public class sanity { public static string test(string name) { return "Hello "+ name + ", from Virtuoso"; } }
This sample needs to be compiled into bytecode assembly before it can be used. Use a command prompt that is suitably set up to find .NET utilities in its path, the .NET Framework SDK installation provides a shortcut in the Start menu to a command prompt that is preconfigured. From the command prompt change directory to the Virtuoso server root containing the C# source file. Execute:
C:\Program Files\OpenLink\Virtuoso 3.0\bin>csc /target:library sanity.cs Microsoft (R) Visual C# .NET Compiler version 7.00.9466 for Microsoft (R) .NET Framework version 1.0.3705 Copyright (C) Microsoft Corporation 2001. All rights reserved.
Now this library must be introduce to the Virtuoso Server. Using ISQL use the following commands to test the CLR:
C:\Program Files\OpenLink\Virtuoso 3.0\bin>isql 1112 Connected to OpenLink Virtuoso Driver: 03.00.2315 OpenLink Virtuoso ODBC Driver OpenLink Interactive SQL (Virtuoso), version 0.9849b. Type HELP; for help and EXIT; to exit. SQL> DB..import_clr (vector ('sanity'), vector ('sanity')); Done. -- 300 msec. SQL> select sanity::test('Rob'); callret VARCHAR ______________________________________________ Hello Rob, from Virtuoso 1 Rows. -- 60 msec.
Congratulations, you have proven that your Virtuoso server can run .NET classes.