Linq To Sql - How to get # inserted records

How can I get the number of inserted records?

Is there an easier way with L2S than to count earlier and count after and accept the difference?

+3
source share
2 answers

Can you try using this feature?

_db.GetChangeSet().Inserts.Count();

Where is _db your datacontext, and you need to do this before you guess your changes?

+3
source

SubmitChanges , , . db.GetChangeSet.Count(), . SubmitChanges , GetChangeSet.Count() db.

0

Source: https://habr.com/ru/post/1707252/


All Articles