0

How to make AddOrUpdate() generating update t-sql?

How to make AddOrUpdate() generating t-sql sent to sql server in sequence?

How to create multiple columns 'reference' index in EF6?

come on

3
  • As good as this idea may seem, it's generally better to ask a single question per question, and ensure that your grammar is as good as possible. Also, try to replicate the scenario that prompted the question, then ask about that, rather than the question itself. Commented Sep 24, 2016 at 16:04
  • @QPaysTaxes I wonder about how you guys judge this, BTW, your top tags are irrelevant to .net, everyone display in front of me want to put on hold the question are irrelevant to .net . Commented Sep 26, 2016 at 7:17
  • or you guys just carry out political action, tell me your points, or I will never ever edit my question. Commented Sep 26, 2016 at 13:01

1 Answer 1

0

This is to gather all the solutions of pitfall I encountered on initializing System.Data.Entity.Migrations.DbMigrationsConfiguration.Seed().

I am T-SQL master, but I'm not EF master due to I always on the MS SQL side.

I found DbContext.AddOrUpdate(new instance(){}) didn't generate the update T-sql, and throw exception when EF encountered inserting the repeat row error in sql server.

Here is the solution gave by roelant-m:

migrationdbsett addorupdate trouble

When I solved the AddOrUpdate(new Instance(){}) inserting same row problem, I encountered the EF optimizing problem, yeah, he is so smart that optimize all the AddOrUpdate( new instance()) in method Seed(). and then he throw exceptions.

Due to the Initializing database must be in sequence (some table has referenced the other tables.)

Here is the solution gave by endi zhupani:

how to make the addorupdate run in order in dbmigrationconfiguration derived

When I solved the initializing AddOrUpdate(new Instance(){}) in sequence, I encountered the multiple column 'references' index, some element of the index are navigation property.

Here is solution gave by sampath:

how to create multi columns reference index join index in csharp model

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.