This is a feature request for migrationBuilder and its InsertData method to return SELECT scope_identity() to get LAST INSERT ID.
This is currently supported outside of migrations, after context.SaveChanges();
Scenario:
The case is when database does provide the Primary key / ID column. Example auto increment ID which is auto increment integer.
After creating new migration, inside Up() you want to Insert Data. And then you want to insert another data, which is related to first insert data, you need to know the Id value which is provided by database, and should not be provided in c# code during Up() .
Current workaround is to do manual SQL statement for getting this inside migration.
Limitations of model seed data - Data that needs key values to be generated by the database, including entities that use alternate keys as the identity - Use the Manual migration customization
Please improve this and support InsertData to return the database provided ID...
This is a feature request for migrationBuilder and its InsertData method to return SELECT scope_identity() to get LAST INSERT ID.
This is currently supported outside of migrations, after context.SaveChanges();
Scenario: The case is when database does provide the Primary key / ID column. Example auto increment ID which is auto increment integer. After creating new migration, inside Up() you want to Insert Data. And then you want to insert another data, which is related to first insert data, you need to know the Id value which is provided by database, and should not be provided in c# code during Up() . Current workaround is to do manual SQL statement for getting this inside migration.
Current behavior:
Please improve this and support InsertData to return the database provided ID...