Making Table valued functions in C#
HO-S-14 Making Table valued functions in C#
Using C# Objects to make table valued functions.
Overview
The following tutorial demonstrates how Virtuoso can be extended through the use of a .NET bound language such as C# to create resultsets.
The demonstrations in this section highlight transparent integration (hosting) between Virtuoso and the Microsoft .NET and Mono implementations of the ECMA Common Language Infrastructure (CLI) as well as how to use the Virtuoso in-process ODBC client to call back the server from hosted managed code.
Prerequisites
The following prerequisites ensure the usability of these tutorial demos on Windows or Linux (and in other future Mono implementations):
- Linux
- Mono Runtime and Frameworks (ideally the version bundled with Virtuoso)
- Mono SDK (if you seek to write your own Objects for integration with Virtuoso)
- Virtuoso Universal Server for Linux with Mono Hosting
- Virtuoso .NET provider
- 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
- Virtuoso .NET provider
Tutorial Example
The following tutorial shows how C# classes can interact with the Virtuoso server.
Please follow the steps below to maximize the value of this tutorial:
- Copy the file ho_s_14.dll next to the OpenLink.Data.VirtuosoClient.dll (if not allready there).
- Click on the "Set Initial State" link which registers the C# class with Virtuoso. Click on the "ho_s_14.sql" link to see the code behind this step
- Click on the "Run" links to actually experience the demo
Demo Breakdown
- "ho_s_14.sql" registers the "openlink.virtuoso.tutorial.ho_s_14.add_data" C# static method with Virtuoso. Click on the "ho_s_14.cs" link to see the C# source code of this class
- "vsp1.vsp" uses the static method "add_data" of the "openlink.virtuoso.tutorial.ho._s_14" class to make a resultset (like a SQL function would) through an in-process connection to the server. Take note of the usage of "OpenLink.Virtuoso.InProcessPort" key from AppDomain.GetData() to get the port on which the hosting Virtuoso server is listening at.
In order to run this example you need Virtuoso Universal Server for Linux with Mono Hosting or Virtuoso Universal Server for Windows with .NET CLR Hosting.
| View the source | Action |
|---|---|
| 1. ho_s_14.sql | Set the initial state |
| 2. ho_s_14.cs | |
| 3. vsp1.vsp | Run |
OpenLink Home
Technical Support