Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework for DB2

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?
like image 289
Yuriy Frolov Avatar asked Dec 04 '13 13:12

Yuriy Frolov


People also ask

Can Db2 run on AWS?

AWS Database Migration Service (AWS DMS) now supports IBM Db2 z/OS as a source for the full load operational mode. Using AWS Schema Conversion Tool (SCT), you can convert schemas and code objects from IBM DB2 z/OS to Aurora MySQL, Aurora PostgreSQL, MySQL and PostgreSQL targets.

What is the Entity Framework used for?

The Entity Framework enables developers to work with data in the form of domain-specific objects and properties, such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored.

What is SQL Entity Framework?

Entity Framework Core is a modern object-database mapper for . NET. It supports LINQ queries, change tracking, updates, and schema migrations. EF Core works with many databases, including SQL Database (on-premises and Azure), SQLite, MySQL, PostgreSQL, and Azure Cosmos DB.


2 Answers

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):

http://www.devart.com/dotconnect/db2/features.html

http://www.devart.com/dotconnect/db2/docs/

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.

like image 108
Devart Avatar answered Sep 18 '22 15:09

Devart


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

Enjoy!

like image 40
Simon Mattes Avatar answered Sep 21 '22 15:09

Simon Mattes