-
-
Notifications
You must be signed in to change notification settings - Fork 618
Closed
Labels
Description
I am having an issue using the BulkInsertOrUpdate functionality whilst trying to insert a list of records into a sqlite database.
public async Task BulkInsertOrUpdate(List<TEntity> entities)
{
var bulkConfig = new BulkConfig
{
SetOutputIdentity = true,
PreserveInsertOrder = false
};
await _context.BulkInsertOrUpdateAsync(entities, bulkConfig);
}
The list contains a basic list of entities with the following properties:
Id - int
Version - byte[]
FirstName - string
LastName - string
When the entities are created, they do not have an Id set i.e. Id=0. When I use BulkInsertOtUpdate, only 1 record is added to the database. This record is generally the last item in the list and it has an Id of 0.
When I use the BulkInsert method, the records are inserted correctly and their Ids are automatically set.
I can also insert the entities if I manually set the Id myself, however, I would like to avoid this as it will crreate a large overhead for me if I had to do this for the more complex entities.