Page 1 of 1

Is a bug for EF MigrateDatabaseToLatestVersion?

Posted: Wed 31 May 2017 07:25
by zipiii
Hi

I am trying to implement dotConnect for Oracle and EF MigrateDatabaseToLatestVersion.

I am using EF6, Oracle 11g and dotConnect for Oracle 9.2.187.

When using MigrateDatabaseToLatestVersion, every program runtime execution method of Configuration.Seed(), resulting in repeated insert data.

I am attaching simple project where the situation can be replayed.
http://pan.baidu.com/s/1hrK2I9Y
or
https://github.com/zipiii/MyDevart.EF6.Test

To run the project please modify connection string, create oracle db, create schema abp1 and run Update-Database migration command and run it.

Please help me!
My customer username is [email protected].

thx!

Re: Is a bug for EF MigrateDatabaseToLatestVersion?

Posted: Fri 02 Jun 2017 14:18
by Shalex
When using MigrateDatabaseToLatestVersion, every program runtime execution method of Configuration.Seed(), resulting in repeated insert data.
Please use

Code: Select all

context.Products.AddOrUpdate(...);
instead of

Code: Select all

context.Products.Add(...);
to avoid repeated inserts. We have just sent a test project to your email.