8.5.Using Microsoft Entity Frameworks to Access Informix Schema Objects with Virtuoso

Abstract

This section details the steps required to provide Microsoft Entity Framework access to Informix Schema Objects using the OpenLink Virtuoso Universal Server. This is achieved by linking the required Informix 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 Informix Schema objects linked into the Virtuoso Server.

Prerequisites. The following prerequisites must be in place for this solution to be possible.

Informix DBMS. An Informix DBMS hosting the required Schema Objects needs to be available. In this section the Informix stores_demo sample database will be used to demonstrate the process.

An Informix DBMS hosting the required Schema Objects needs to be available. In this section the Informix stores_demo sample database will be used to demonstrate the process.

ODBC Driver for Informix. An Informix ODBC Driver is required for Linking the Informix Schema Objects into the Virtuoso Server. The OpenLink ODBC Driver for Informix will be used in this section, for which a functional ODBC Data source name of "inf10ma" will be assumed to exist on the machine hosting the Virtuoso Server.

An Informix ODBC Driver is required for Linking the Informix Schema Objects into the Virtuoso Server. The OpenLink ODBC Driver for Informix will be used in this section, for which a functional ODBC Data source name of "inf10ma" will be assumed to exist on the machine hosting the Virtuoso Server.

Virtuoso Universal Server. An Virtuoso installation including the Virtuoso Universal Server and ADO.NET Entity Framework Provider is required. The Virtuoso components used must be Release 5.10.x or above, this being the minimum version containing support for Microsoft Entity Frameworks

An Virtuoso installation including the Virtuoso Universal Server and ADO.NET Entity Framework Provider is required. The Virtuoso components used must be Release 5.10.x or above, this being the minimum version containing support for Microsoft Entity Frameworks

Microsoft Visual Studio 2008 SP1. Microsoft Visual Studio 2008 Service Pack 1 is required, this being the only version containing the necessary Entity Framework support available at the time of writing.

Microsoft Visual Studio 2008 Service Pack 1 is required, this being the only version containing the necessary Entity Framework support available at the time of writing.

Tasks

Ensure Informix Primary Keys (PKs) are not nullable. The Visual Studio 2008 Entity Data Model (EDM) requires that all primary keys are NOT Nullable, and will fail to generate an EDM if any are. Thus ensure any tables to be used are defined as not nullable in the Informix database schema before attempting to generate an EDM. In the case of the Informix stores_demo database many tables have primary keys that are nullable so these will need to be redeclared.

The Visual Studio 2008 Entity Data Model (EDM) requires that all primary keys are NOT Nullable, and will fail to generate an EDM if any are. Thus ensure any tables to be used are defined as not nullable in the Informix database schema before attempting to generate an EDM. In the case of the Informix stores_demo database many tables have primary keys that are nullable so these will need to be redeclared.

This is possible using dbaccess however care needs to be taken, particularly with the following

  • Amending a PK field to be not nullable can results in the primary key constraint being removed.

  • Amending a PK field to be not nullable when the primary key is referenced by a foreign key constraint results in the foreign key constraint being removed.

In both of the cases above the primary key and foreign key constraints that are removed will have to be manually recreated.