Hi,
I want to Truncate a Table using Entity Framework so that all records are deleted and also the Identity Column is reset.
Please suggest.
You can do in following way.
using (CustomersEntities entities = new CustomersEntities()) { //Truncate Table to delete all old records. entities.Database.ExecuteSqlCommand("TRUNCATE TABLE [Customers]"); }
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.