Linq To SQL, DO NOT SELECT SCOPE_IDENTITY () after INSERT

This is a continuation of the question Stop LINQ to SQL from executing select statements after insertion , which for some reason remained unanswered.

I insert 10,000 rows into the table, the primary key is automatically created by the SQL server. After inserting the lines, I do not need to process them, and the program closes.

When you look at the LINQ to SQL log for each INSERT, a sequential SELECT statement is created for SCOPE_IDENDITY (). I feel that this is slowing down my program, and I would like to get rid of it.

How to insert an INSERT without an immediate SELECT?

+3
source share
1 answer

If you're worried about performance, I'm afraid you need to completely change your approach.

Linq to Sql bulkinserts - , .

, - SqlBulkCopy. .

+2

All Articles