Skip to content

Enabling identity insert for InsertAll() #110

Description

@phillijw

For some reason I am not able to enable identity insert, do the bulk insert, then disable it again. Am I doing something wrong or is this a bug?

db.Database.ExecuteSqlCommand("SET IDENTITY_INSERT [dbo].[Orders] ON");
EFBatchOperation.For(db, db.Orders).InsertAll(olist);
db.Database.ExecuteSqlCommand("SET IDENTITY_INSERT [dbo].[Orders] OFF");

This code ignores the value I've set on the model and uses the next available seeded record in the table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions