SQLServer database trigger and optimistic concurrency


I have enabled optimistic concurrency and there is a table where I use a after insert trigger where a set a column value in the table on insert (special logic?

the problem is that this change in the trigger for that column is not reflected in the grid after reload the data with grod0.reload() and the Update fails in the page because there is a concurrency conflict.

how to refresh/reload the data after insert to reflected also Trigger changes?


I'm not sure if I understand - you mean I should add "AsNoTracking()"?

the problem is not the grid itself - if I open the new row in the edit form and press save I get an error:

If I look at the update SQL statement I can see that the value of the column whcih was changed in the database Trigger is still the default value not the value in the inserted row...


I suggest you to read the following article:

EF context will not know that you've changed something in the database. This is not related to the Radzen DataGrid or any other Radzen component.

the problem is not the "Tracking" because the value of that column is Computed on the server inside the Trigger but EF doesn't recognize this.
In the model there is the [ConcurrencyCheck] Annotation so removing this is a solution or to add this:

public string Aktenzahl

the problem is that If I change this it is not persistant because on the next database refresh the model definition is overwritten...

You can extend your database model (DbContext) using fluent API in a partial class instead attributes:

1 Like

it works if I set ValueGeneratedOnAddOrUpdate();

    partial void OnModelBuilding(ModelBuilder builder)
            .Property(p => p.Aktenzahl)