Often we want to absorb records (let’s say from an import of data) into a SQL Server db.
Some records in the import will have Ids and will already exist in the database. Some are new. Let’s say there are 1000 records.
I was doing some reading in a competing library where their method to batch insert actually returns the identities for new records.
Is there any way to do this with OrmLite’s
Right now we have logic that tries to do this manually in a non-performant way:
- Find all records that do already exist, and manually create SQL update strings and batch call them to update the data.
- Then loop 1 by 1 and call
Saveon each item to ensure it is inserted and the identity Id is returned.
There must be a better way that OrmLite can better help facilitate this?