Product Documentation

FairCom ADO.NET Driver - Developer's Guide

Previous Topic

Next Topic

Entity Framework 6 Support

Support for Entity Framework 6.x (EF6) is implemented in a separate DLL named Ctree.Data.EntityFramework.dll.

Support for previous versions, up to EF4, is available as the Ctree.Data.SqlClient.Entity namespace inside the ADO.NET provider DLL (Ctree.Data.SqlClient.dll). See ADO.NET Entity Framework V2 - V4 Support.

To test or use the EF6 support, the following steps must be taken:

Note: This support has been tested with Visual Studio 2012 and 2013.

Be sure your FairCom DB package is installed. If you used the .zip installer, be sure you have executed <faircom>\tools\SetUp\FairComConfig.exe to register the ADO.NET driver.

  1. Start Visual Studio 2012 (or newer).
  2. Create a new Console Application project.
  3. Right-click the project node and select Manage NuGet Packages.
  4. From the packages list, select Entity Framework. This step is required to install the latest EF6 package in Visual Studio 2012 (Visual Studio 2013 should already have this package built-in).
  5. Open the app.config file and replace the following line:

    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />


    <provider invariantName="Ctree.Data.SqlClient" type="Ctree.Data.EntityFramework.CtreeSqlProviderServices, Ctree.Data.EntityFramework" />

  6. In Solution Explorer add a reference to the Ctree.Data.EntityFramework.dll located by default in the \FairCom\V10.4.0\win*\bin\ directory (you may also remove the reference to EntityFramework.SqlServer).
  7. Click Build > Rebuild Solution.
  8. Right-click the project node and select Add > New Item.
  9. From the Data category select ADO.NET Entity Data Model.
  10. Select Generate from Database.
  11. If no previous connection is present, click New Connection.
  12. The FairCom DB SQL datasource should appear. If it does not:
    1. Click Change.
    2. Select FairCom DB SQL from the list of available datasources.

    Note: If the FairCom DB SQL datasource is not listed among the available datasources, you did not properly register the datasource for the version of Visual Studio you are using. Please refer to ADO.NET installation documentation for information on how to register the datasource. For a quick registration in Visual Studio 2012, locate the FairComDDEXProvider_v11_Config.reg file in the win*\bin\ directory, double-click it, and click OK on all confirmation dialogs.

  13. Check the values in the Connection Properties dialog and adjust them if needed (you can click Advanced for additional connection string options).
  14. Click Test Connection to verify that the provider can successfully connect to the FairCom Server.
  15. Click Next and you should be able to select one or more tables from the list of available ones and click Finish.

    Note: Remember that, to properly work in the EF6 environment, the tables should have a "primary key" defined.

If everything works as expected, a model (.edmx file) will be generated.