ASP.NET 5 & Entity Framework 7 Seeding data not in sequential code order

I am using ASP.NET 5 RC1 and Entity Framework 7 RC1

I have the following class method

public class MySeedData
    private MyDb_context;

    public MySeedData(MyDb db)
        _context = db;

    public void DoSeedData()
        if (!_context.Table1s.Any())
              new Table1{ Table1Name= "AAAA" },
              new Table2{ Table1Name= "BBBB" },
              new Table3{ Table1Name= "CCCC" }

and then in the Configure method of my Startup.cs


However when I query the db I notice that the rows were not created in the order the code is listed. The Id gets generated by the database.

Output is




For tables with lots of seeding data, the order looks even very random.

I assume this is to do with asynchronous processing.

The question is how do I force it to be synchronous and sequential?


You can add one by one instead of using the AddRange that way you can guarantee the order

Need Your Help

How to Read certain values from a String in Android

java android arrays string

I'm developing an android application where I'm reading results from an online database to a string of this form:

How to specify which functions/methods should be covered by a test, using Karma, Jasmine, and Istanbul

javascript unit-testing jasmine code-coverage istanbul

I am trying to figure out how to restrict my tests, so that the coverage reporter only considers a function covered when a test was written specifically for that function.