How can I get the number of records that were inserted?
Is there an easier way, with L2S, than count before and count after and taking the difference?
How can I get the number of records that were inserted?
Is there an easier way, with L2S, than count before and count after and taking the difference?
Can you try use this functionality ?
_db.GetChangeSet().Inserts.Count();
Where _db - your datacontext and it need to do before sumbit your changes ?
The db.SubmitChanges does not give you the actual records that were affected by the inserts, deletes and updates to the database. Looking at db.GetChangeSet.Count() does give you the truth. It is only when an error occurs during the SubmitChanges call that the numbers in the GetChangeSet.Count() will differ from the actual situation in the db.