EF6 Alpha 3 support

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
John Liu
Posts: 61
Joined: Wed 14 Nov 2012 20:58

EF6 Alpha 3 support

Post by John Liu » Mon 08 Apr 2013 23:38

Hi,
I just upgraded EF6 from Alpha 2 to Alpha 3, and devart oracle provider from 7.5.164.0 to 7.7.217.0. Everything worked fine in the Alpha 2 + dcoracle75pro environment. now I'm having issue with __MigrationHistory table owner. The sql script generated by Alpha 2 + dcoracle75pro is
CREATE TABLE "__MigrationHistory" (
"MigrationId" NVARCHAR2(255) NOT NULL,
"ContextKey" NVARCHAR2(512) NOT NULL,
"Model" BLOB NOT NULL,
"ProductVersion" NVARCHAR2(32) NOT NULL,
PRIMARY KEY ("MigrationId", "ContextKey")
)
which works great when the login name is the table owner name.

The sql script generated by Alpha 3 + dcoracle77pro is
CREATE TABLE "azteca"."__MigrationHistory" (
"MigrationId" NVARCHAR2(255) NOT NULL,
"ContextKey" NVARCHAR2(512) NOT NULL,
"Model" BLOB NOT NULL,
"ProductVersion" NVARCHAR2(32) NOT NULL,
PRIMARY KEY ("MigrationId", "ContextKey")
)
which produces ORA-01918: user 'azteca' does not exist error. However, the following two scripts would work.
CREATE TABLE azteca."__MigrationHistory" (
"MigrationId" NVARCHAR2(255) NOT NULL,
"ContextKey" NVARCHAR2(512) NOT NULL,
"Model" BLOB NOT NULL,
"ProductVersion" NVARCHAR2(32) NOT NULL,
PRIMARY KEY ("MigrationId", "ContextKey")
)
CREATE TABLE "AZTECA"."__MigrationHistory" (
"MigrationId" NVARCHAR2(255) NOT NULL,
"ContextKey" NVARCHAR2(512) NOT NULL,
"Model" BLOB NOT NULL,
"ProductVersion" NVARCHAR2(32) NOT NULL,
PRIMARY KEY ("MigrationId", "ContextKey")
)
I added modelBuilder.HasDefaultSchema("AZTECA"); that doesn't help.
please help?

John Liu
Posts: 61
Joined: Wed 14 Nov 2012 20:58

Re: EF6 Alpha 3 support

Post by John Liu » Mon 08 Apr 2013 23:45

I tried to customize Code First Migrations History Table by following this post http://entityframework.codeplex.com/wik ... tomization

I got the following error message.

PM> update-database -verbose -targetmigration V20120100 -script
Using StartUp project 'Cityworks.DataAccess'.
Using NuGet project 'Cityworks.DataAccess'.
Target database is: '' (DataSource: 192.168.20.86, Provider: Devart.Data.Oracle, Origin: Configuration).
Migrating the history system table is only supported for move table operations. Ensure all other history table configuration happens as part of an initial explicit migration
Please help.
Thanks so much!

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: EF6 Alpha 3 support

Post by Shalex » Thu 11 Apr 2013 13:06

We cannot reproduce the problem at the moment. We have sent a test project to the e-mail which is specified in your profile on the forum.

John Liu
Posts: 61
Joined: Wed 14 Nov 2012 20:58

Re: EF6 Alpha 3 support

Post by John Liu » Thu 11 Apr 2013 17:47

Thank you for sending me the test project. There are several differences between your project and mine. It seems the only one that matters is the SetSqlGenerator command you have inside the Configuration constructor.

public Configuration()
{
AutomaticMigrationsEnabled = false;
this.SetSqlGenerator(OracleConnectionInfo.InvariantName,new OracleEntityMigrationSqlGenerator());
}
After I add this.SetSqlGenerator(OracleConnectionInfo.InvariantName,new OracleEntityMigrationSqlGenerator()); to my project, Everything starts to work correctly. I didn't have this line of code, but the project worked fine with EF6 alpha2 + dcoracle75pro.
There is one more issue that my project needs to work with both Sql Server and Oracle ( not at the same time). Since there is no DbContext here, how do I know when to set the generator for oracle or the one for sql server.

Thanks
JL

John Liu
Posts: 61
Joined: Wed 14 Nov 2012 20:58

Re: EF6 Alpha 3 support

Post by John Liu » Thu 11 Apr 2013 22:54

Actually, It's not an issue. We can define a sqlgenerator for oracle and another one for sql server side by side.
thanks
JL

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Re: EF6 Alpha 3 support

Post by Shalex » Thu 18 Apr 2013 07:20

MigrationSqlGenerator for provider 'Devart.Data.Oracle' can be set either in code (in the Configuration() constructor) or in *.config (http://blogs.devart.com/dotconnect/enti ... force.html).

Post Reply