I have a Blazor EditForm and I use Model to relate it to the object and to bind the controls.
EditForm Model="@Client" OnValidSubmit="SubmitForm"
I use EF Core to bring the data from the model when the user wants to edit it,
var Client = _dbContext.Set().FindAsync(id);
However, when the user enters to edit a Client and changes a piece of data, but then leaves the form without saving it by no pressing the save button, if he returns to the form to edit the same record, the field that was modified without saving shows the data that the user had captured, this is because of the tracking that EF Core does.
If I change my code tovar client = _dbContext.Set().AsNoTracking().FirstOrDefaultAsync(c => c.ClientId == id),
EF Core no longer does the tracking and that solves the problem.
What I would like to know is if doing this is correct and if it affects the performance of my system.
Thank you.