Stuck in a development rut? These 10 ASP.NET Core features might inspire you to try a new approach! As web developers, it is common for us to keep turning to the same old solutions for different problems, especially when we are under pressure or dealing with tight deadlines. This happens because we often follow code patterns that we have already mastered, either because we are unaware of other alternatives or even because we are afraid of using new options and things getting out of control.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Using Microsoft.entity FrameworkCore.Infrastructure
Delete All Rows in Entity Framework Core 6
Download EfCoreCleanHelper.zip - 19.8 KB Background Sometimes we may require to delete all the records from the table using Entity Framework Core. One of the commonly used approaches is to iterate each row and use the DBSet<T>.Remove() to delete each row, as shown below. foreach (var item in Db.Users) { Db.Users.Remove(item); } Db.SaveChanges(); This process is slower than Truncate/Delete and not suitable for large datasets.
Delete All Rows in Entity Framework Core
Download EfCoreCleanHelper.zip - 19.8 KB Background Sometimes we may require to delete all the records from the table using Entity Framework Core. One of the commonly used approaches is to iterate each row and use the DBSet<T>.Remove() to delete each row, as shown below. foreach (var item in Db.Users) { Db.Users.Remove(item); } Db.SaveChanges(); This process is slower than Truncate/Delete and not suitable for large datasets.
Executing Raw SQL Queries using Entity Framework Core 6
Download EfCoreHelper.zip - 18.2 KB Background Entity Framework Core allows us to drop down to raw SQL queries when working with a relational database. Plus it provides mechanisms for executing raw SQL queries directly against the database using ADO.NET features. Here we are going to explore both existing and custom options to run row SQL in Entity Framework Core but will focus more on extension method implementations using ADO.NET.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Using Microsoft.entity
Contact Using Microsoft.entity, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack