Giter VIP home page Giter VIP logo

Comments (6)

forsti83 avatar forsti83 commented on June 1, 2024 1

Hi Jon,

thank you very much for the detailed information!

Best regards,
Andreas

from entityframework-classic.

JonathanMagnan avatar JonathanMagnan commented on June 1, 2024

Hello @forsti83 ,

I believe disabling the option BatchMigration in your context constructor will make the job:

public BloggingContext() : base((My.ConnectionString))
{
	this.Configuration.BatchMigration.IsEnabled = false;
}

Let me know if that fixed it.

Best Regards,

Jon

from entityframework-classic.

forsti83 avatar forsti83 commented on June 1, 2024

Hello @JonathanMagnan ,

that fixed it. Thank you very much! Has EF Classic another default value for this config setting than EF?

Best Regards,
Andreas

from entityframework-classic.

JonathanMagnan avatar JonathanMagnan commented on June 1, 2024

Hello Andreas,

I'm not sure to understand you question.

If you ask if there is another config that could affect the migration, I believe that's the only one

from entityframework-classic.

forsti83 avatar forsti83 commented on June 1, 2024

Hello Jon,

no, the question is, if you have a clue, why our migrations are working with EF 6.4.4 (without setting the BatchMigration config option to false), but are failing with EF Classic 7.1.34 (again without setting the BatchMigration config option to false)?

Thank you and best regards,
Andreas

from entityframework-classic.

JonathanMagnan avatar JonathanMagnan commented on June 1, 2024

Oh,

It fail in EF Classic since by default, we batch command.

Which means, instead of executing for example 100 SQL command to create all your tables and index, perhaps only 1-2 commands are executed.

So when batching the migration, this part will be executed way faster.

However, a custom script like your make SQL fail unless it's in a execute method.

This is similar to creating first a table:

CREATE TABLE A
(
	ColumnInt INT
)

then executing the following SQL

ALTER TABLE dbo.A
ADD ColumnInt2 INT

UPDATE A
SET ColumnInt2 = 1

even if somewhat valid, you will get the same error.

However, you found a workaround to make it works with the EXEC.

When directly in SSMS, you can also use the "GO" workaround:

ALTER TABLE dbo.A
ADD ColumnInt2 INT

GO

UPDATE A
SET ColumnInt2 = 1

GO

Let me know if that explains correctly the current behavior.

from entityframework-classic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.