<!--
 -  
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2018 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<?xml version="1.0" encoding="ISO-8859-1"?>
<refentry id="HO-S-11">
  <refmeta>
    <refentrytitle>ECMA-CLI(Mono)/.Net CLR Runtime Hosting</refentrytitle>
    <refmiscinfo>tutorial</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>Integrating Common Language Runtime Objects with Virtuoso</refname>
    <refpurpose>Using Restrictions for C# Imported types.</refpurpose>
  </refnamediv>

    <refsect1 id="HO-S-11a_overview">
    <title>Overview</title>
    <para> This tutorial demonstrates the options PERMISSION_SET = SAFE and 
	PERMISSION_SET = UNRESTRICTED on CREATE LIBRARY / ASSEMBLY.</para>
    </refsect1>
 
    <refsect1 id="HO-S-11a_prerequisites">
    <title>Prerequisites</title>
    <para>The following prerequisites ensure the usability of these demos on Windows</para>
<itemizedlist>
<listitem>Windows
   <itemizedlist>
     <listitem>.NET Runtime and Frameworks</listitem>
     <listitem>.Net Runtime and Framework SDK (if you seek to write your own Objects for integration with Virtuoso)</listitem>
     <listitem>Virtuoso Universal Server for Windows with .NET CLR Hosting</listitem>
     </itemizedlist></listitem>
</itemizedlist>
    </refsect1>

    <refsect1 id="HO-S-11a">
    <title>Tutorial Example</title>

  <para>The tutorial shows how C# classes are used to create User
  Defined Types (UDTs) in Virtuoso. </para>
  <para>Please follow the steps below to maximize the value of this tutorial:</para>

<orderedlist>
 <listitem>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.</listitem>
 <listitem>Click on the "Run" links to execute the demo.</listitem>
</orderedlist>

<para>Demo Breakdown</para>

<orderedlist>
 <listitem>"ho_s_11.sql" performs the following steps
  <orderedlist>
   <listitem>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.</listitem>
  </orderedlist></listitem>

 <listitem>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.</listitem>
</orderedlist>
    </refsect1>
</refentry>
