May 12 2025
foreach (var customer in customers)
{
context.Customers.Add(customer);
}
await context.SaveChangesAsync();
// 100+ options to customize your saves
// Insert only customers that don't exist with a custom key
context.BulkInsert(customers, options => {
options.InsertIfNotExists = true;
options.ColumnPrimaryKeyExpression = customer => customer.Code;
});
// Merge (Upsert) with related child entities (Order, OrderItem)
context.BulkMerge(orders, options => {
options.IncludeGraph = true;
});
await context.BulkUpdate(inactiveCustomers);
await context.BulkMerge(products);
await context.BulkDelete(expiredLogs);
var transaction = context.Database.BeginTransaction();
try
{
context.BulkSaveChanges();
transaction.Commit();
}
catch
{
transaction.Rollback();
}
1. Design Patterns that Deliver
This isn’t just another design patterns book. Dive into real-world examples and practical solutions to real problems in real applications.Check out it here.
Go-to resource for understanding the core concepts of design patterns without the overwhelming complexity. In this concise and affordable ebook, I've distilled the essence of design patterns into an easy-to-digest format. It is a Beginner level. Check out it here.
Every Monday morning, I share 1 actionable tip on C#, .NET & Arcitecture topic, that you can use right away.
Join 15,250+ subscribers to improve your .NET Knowledge.
Subscribe to the TheCodeMan.net and be among the 15,250+ subscribers gaining practical tips and resources to enhance your .NET expertise.