We have a EF model of a DB2 database.
Is it possible to use this model to generate a SQL Server database? And then switch between using DB2 开发者_JS百科and SQL Server?
We were thinking that the developers could develop against a local SQL Server database.
We use EF 4.1.
There can be problems with the field types, if you define them for yourself. I have been doing such a thing with Sql-Oracle, and in the end, we where creating custom Attributes, like [VarcharAttribute] and configured the entities to use the correct typename in the OnModelBuilder function.
This might not work :
[Column(TypeName="varchar")]
public string Data{get;set;}
because for Oracle it should look like this :
[Column(TypeName="VARCHAR2")]
public string Data{get;set;}
Also there can be other problems, for example in the sql-oracle merge a table name was over 30 characters, and it worked in sql, but didn't work in oracle, because the table name was limited to 30 characters.
But after you fix these problems, then it will work. At the end we were able to set the provider from config file.
So yes, it is possible, if you take care of the database differences
Old question but...
You can't use migrations with IBM DB2 EF Provider.
About EF 6 (without migration) for DB2, now is supported by IBM
You can find official nuget package for EF support here
http://www.nuget.org/packages/EntityFramework.IBM.DB2/
but it does not support migrations.
If you need migration you can use also this package (in addition to previous package)
https://www.nuget.org/packages/System.Data.DB2.EntityFramework.Migrations/
You can find more info here
https://db2ef6migrations.codeplex.com/
精彩评论