Entity Framework for DB2

db2 entity-framework


I need to setup Entity Framework to work with a DB2 database. The main reason is to have nice object model instead of data sets and stored procedures.

The questions I have:

  1. Does the version of EF matter? I'd like to use v6 but so far I found only references to v4.
  2. Am I required to work with edmx file or can I also use DBContext (code first with an existing database)?
  3. How should the configuration file look like?
3/12/2014 4:01:31 PM

Accepted Answer

Regarding your questions:

  1. The standard data provider for DB2 doesn't support EF6, Code-First, Code-First Migrations. In case, your scenario requires these features, you should use third-party data providers.
  2. Yes, you could use the DbContext class with the standard data provider via Database-First approach, i.e. without its Code-First/Code-First Migrations functionality.
  3. It depends on the scenario and data provider being used. When working with the standard data provider it is enough to register the Entity Framework provider in the DbProviderFactories section of the config file for deploying the application. When working with EF6 and data providers, which support EF6, it is necessary to register the Entity Framework provider in the entityFramework section additionally (for example, please refer to this article ).

Please take a look at our data provider dotConnect for DB2 with Entity Framework support (including EF6):



The DataDirect also provides a data provider for DB2 - http://www.datadirect.com/support/product-documentation/product-information/support-matrices/datadirect-connect-for-ado-net/entity-framework-data-providers , however, it doesn't provide support for Entity Framework 6.

12/5/2013 12:07:06 PM

Popular Answer

Good news: there is a nuget package from IBM you can use: http://www.nuget.org/packages/EntityFramework.IBM.DB2/


Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow