EF6 Beta 1 Code First Migration Script Generation Issue

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 Beta 1 Code First Migration Script Generation Issue

Post by John Liu » Fri 05 Jul 2013 17:58

Using package Manager console command
PM> Update-Database -verbose -script
the script generated by dotConnect for oracle includes a delimiter (/) to separate each command. if I use the following code to generate the script, the delimiter (/) is not included. Do we have a option to include the delimiter (/)?
var scriptor = new MigratorScriptingDecorator(migrator);
var scripts = scriptor.ScriptUpdate();
thanks
JL

PM> Update-Database -verbose -script
ALTER TABLE AZ.STVINSPECTION
MODIFY TVREASON NVARCHAR2(100) DEFAULT NULL
/
BEGIN
EXECUTE IMMEDIATE 'ALTER TABLE AZ.STVINSPECTION MODIFY TVREASON NULL';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE <> -1451 AND SQLCODE <> -1442 THEN
RAISE;
END IF;
END;
/

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

Re: EF6 Beta 1 Code First Migration Script Generation Issue

Post by Shalex » Mon 08 Jul 2013 11:58

We have reproduced the issue and are investigating it. We will post here about the result.

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

Re: EF6 Beta 1 Code First Migration Script Generation Issue

Post by Shalex » Wed 10 Jul 2013 12:40

The bug with using delimiter when generating Code-First Migrations script via the ScriptUpdate method of the MigratorScriptingDecorator class in Entity Framework 6 is fixed. We will notify you when the corresponding build of dotConnect for Oracle is available for download.

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

Re: EF6 Beta 1 Code First Migration Script Generation Issue

Post by Shalex » Thu 18 Jul 2013 15:00

New version of dotConnect for Oracle 7.8 is released!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=27556.

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

Re: EF6 Beta 1 Code First Migration Script Generation Issue

Post by John Liu » Mon 09 Sep 2013 16:41

I've installed EF6 RC1 and updated to dotConnect for oracle 7.9.322. I still have different issue with script generation. Everything works great inside PM. Both of the following two commands generate the exact SQL scripts as expected.
PM> update-database -targetmigration V1 -verbose -script
PM> update-database -verbose -script

I'm having an issue to generate the scripts programmatically. The following code generate an error. The same code works great with SQL Server provider.
var scriptor = new MigratorScriptingDecorator(migrator);
var scripts = scriptor.ScriptUpdate("0", "V1");

Requested value 'UpdateDatabaseOperation' was not found.

at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)
at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at System.Enum.Parse(Type enumType, String value)
at Devart.Common.Entity.Migrations.c.b(MigrationOperation A_0)
at Devart.Common.Entity.Migrations.e.a(MigrationOperation A_0)
at Devart.Common.Entity.Migrations.e.a(IEnumerable`1 A_0)
at Devart.Common.Entity.Migrations.b.a(IEnumerable`1 A_0, String A_1)
at Devart.Data.Oracle.Entity.Migrations.OracleEntityMigrationSqlGenerator.Generate(IEnumerable`1 migrationOperations, String providerManifestToken)
at System.Data.Entity.Migrations.DbMigrator.GenerateStatements(IList`1 operations, String migrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.GenerateStatements(IList`1 operations, String migrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorScriptingDecorator.ScriptUpdate(String sourceMigration, String targetMigration)
at Cw.DataAccess.DbMgrData.GenerateMigrationSqlScripts(String fromVersion, String toVersion) in c:\CWSource\Server\Cw.DataAccess\Migrations\DbMgrData.cs:line 340

JL

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

Re: EF6 Beta 1 Code First Migration Script Generation Issue

Post by John Liu » Mon 09 Sep 2013 23:01

I changed the code from
var scriptor = new MigratorScriptingDecorator(migrator);
var scripts = scriptor.ScriptUpdate("0", "V1");

to
var scripts = scriptor.ScriptUpdate(null, "V1");

Then, It starts to work correctly now.
by the way, thanks for adding '/' to seperate each command that makes my life easier.
but it adds too many '/r/n', I have to remove some of them
thanks
JL

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: EF6 Beta 1 Code First Migration Script Generation Issue

Post by MariiaI » Thu 12 Sep 2013 10:15

Glad to see that the issue was resolved.
but it adds too many '/r/n', I have to remove some of them
We will consider this behavior.

If you have any further questions, feel free to contact us.

Post Reply