Entity Framework: Get Number of Rows Affected during Insert Update or Delete

Last Reply 2 months ago By Mudassar

Posted 2 months ago


Is there any way to get the rows affected as we have in ADO.Net after Insert, Update or Delete operations in Entity Framework?

If yes please tell how?

You are viewing reply posted by: Mudassar 2 months ago.
Posted 2 months ago

Yes. It is possible using the SaveChanges method of the Entity Framework. It returns an Integer value.

using (CustomersEntities entities = new CustomersEntities())
      int insertedRecords = entities.SaveChanges();


I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html