<docbook><section><title>VirtProgressEntityFrameworkUsage</title><title> Using Microsoft Entity Frameworks to Access Progress Schema Objects with Virtuoso </title> Using Microsoft Entity Frameworks to Access Progress Schema Objects with Virtuoso 
<para>This document details the steps required to provide Microsoft Entity Framework access to Progress Schema Objects using the OpenLink Virtuoso Universal Server.
 This is achieved by Linking the required Progress Schema objects into Virtuoso using its built-in Virtual Database engine and then using the Virtuoso ADO.Net Entity Framework provider to query the remote Progress Schema objects linked into the Virtuoso Server.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Prerequisites </bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> Progress/OE 9 or later DBMS </bridgehead>
<para>A Progress OpenEdge DBMS (with their SQL-92 engine, so v9 or later) hosting the required Schema Objects needs to be available.
 In this document, the <emphasis>isports</emphasis> sample database will be used to demonstrate the process.</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> ODBC Driver for Progress (SQL-92) </bridgehead>
<para>A Progress ODBC Driver is required to link the Progress Schema Objects into the Virtuoso Server.
 The <emphasis><ulink url="http://uda.openlinksw.com/odbc-progress/">OpenLink ODBC Driver for Progress (SQL-92)</ulink></emphasis> will be used in this document, for which a functional ODBC Data source name of <emphasis>prs101c</emphasis> will be assumed to exist on the machine hosting the Virtuoso Server.</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Virtuoso 5.10.x or later </bridgehead>
<para>An OpenLink Virtuoso Universal Server installation including the Virtuoso Universal Server and ADO.NET Entity Framework Provider is required.
 The Virtuoso components must be Release 5.10.x or above, this being the minimum version containing support for Microsoft Entity Frameworks.
 We recommend using <ulink url="http://virtuoso.openlinksw.com/download/">the latest Virtuoso component versions currently available</ulink>.</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Microsoft Visual Studio 2008 SP1 or later </bridgehead>
<para>Microsoft Visual Studio 2008 with Service Pack 1 or later is required, this being the earliest version containing the necessary Entity Framework support.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Tasks </bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> 1 - Ensure Progress Primary Keys (PKs) are not NULLable </bridgehead>
<para>The Visual Studio 2008 Entity Data Model (EDM) requires that all primary keys are NOT NULLABLE.
 Visual Studio 2008 will fail to generate an EDM, if any primary keys are nullable.
 Therefore, ensure that any applicable primary keys are defined as not nullable in the Progress database schema before attempting to generate an EDM.</para><para>By default, several Primary Keys (PKs) in the isports database allows NULL values.
 It seems somewhat nonsensical that a unique key whose sole purpose is to identify rows in tables can be allowed to be NULL.</para><para>This issue is best addressed directly in the database schema, by redefining those PKs that allow NULL so as not to allow NULL.
 Progress documentation does not talk in terms of NULL; instead, it uses the term <emphasis>Mandatory</emphasis>.</para><para>Our documentation provides more specific details about how to <ulink url="http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtProgressPKNull">ensure Progress PKs are not nullable</ulink>.</para><para> </para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 2 - Install and configure ODBC Driver for Progress (SQL-92) </bridgehead>
<para>The Virtuoso Virtual Database engine uses ODBC as the connectivity mechanism for linking remote database objects into its local schema.
 Thus, a Progress ODBC Driver must be available with a suitably configured DSN for connecting to the target database.
 The OpenLink ODBC Drivers for Progress have been used in this document, although in theory any Progress ODBC Driver can be used.</para><para>Installation instructions for the OpenLink ODBC Driver for Progress are available from:</para><itemizedlist mark="bullet" spacing="compact"><listitem> <ulink url="http://wikis.openlinksw.com/UdaWikiWeb/InstallConfigODBC">Product Installation &amp; Basic Configuration (ODBC)</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 3 - Install and configure Virtuoso </bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem> <ulink url="VirtADOClientServInstall">Install and configure OpenLink Virtuoso Universal Server</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 4 - Link Progress tables into Virtuoso </bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem> <ulink url="VirtProgressLinkingObjects">Linking Progress tables into OpenLink Virtuoso</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> 5 - Create a Visual Studio Entity Data Model (EDM) </bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem> <ulink url="VirtProgressEDM">Creating EDM in Visual Studio 2008</ulink></listitem>
</itemizedlist><para>In the event that no entity-linking associations are automatically created (as is the case here with Progress), the <ulink url="VirtProgressAssociations">EDM Associations (FKs) will need to be created manually</ulink>.</para><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Use the EDM to create Entity Framework applications </bridgehead>
<para>Now that a Microsoft Entity Data Model has been created for the Progress isports database, Entity Framework applications can be created to make use of it.</para><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Entity Framework Data Service </bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem> <ulink url="VirtEntityFrameworkProgressDatService">Entity Framework Data Service</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> Visual Studio Windows Form Application </bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem> <ulink url="VirtProgressVisualStudioDataGridFormsApp">Windows DataGrid Form Application</ulink></listitem>
</itemizedlist></section></docbook>