EF does a thorough work to track entity state. In cases where the fact of change is not clear, it's usually better to let EF to manage the update.
ELINQ (pure SQL) is preferred when we don't want to retrieve the entity or a bulk update is needed.
var rows = DbContext.Database.Execute((Taxes taxes) =>
UPDATE(taxes).SET(() => taxes.UpdatedAt = GETDATE()));
Console.WriteLine($"{rows} rows affected");
var one = 0.01M;
var two = 0.02M;
var rows = DbContext.Database.Execute((Taxes taxes) =>
{
UPDATE(taxes)
.SET(() =>
{
taxes.MaxLocalTaxRate += two;
taxes.AvgLocalTaxRate += one;
});
WHERE(taxes.MaxLocalTaxRate == one);
});
Console.WriteLine($"{rows} rows affected");