Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
777 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am working on a Blazor Server application and want to know if there is a way to exclude a property when using the UpdateRange method. Below is the code I am using:
public async Task UpdateReportAsync(List<OrderDetail> reports)
{
await using var ctx = await _db.CreateDbContextAsync();
ctx.UpdateRange(reports);
await ctx.SaveChangesAsync();
}
Any help or guidance is greatly appreciated. Thanks in advance!
As you are using blazor, which is statefull, you could use change tracking rather than marking the whole entity modified.
for your current just mark the property as unmodified.
ctx.Entry(report).Property(x => x.Column ).IsModified = false;
you will need to loop thru reports