Closed Ali-YousefiTelori closed 2 years ago
Is there a way to get Entity in my c# code that inserted, updated, or deleted? for example, I want to get that entity in the trigger action:
modelBuilder.Entity<TEntity>() .AfterInsert(trigger => trigger.Action(action => { action.OnChange((entity) => { Console.WriteLine($"Inserted {entity.Id}"); }); })) .AfterDelete(trigger => trigger.Action(action => { action.OnChange((entity) => { Console.WriteLine($"Deleted {entity.Id}"); }); })) .AfterUpdate(trigger => trigger.Action(action => { action.OnChange((entity) => { Console.WriteLine($"Updated {entity.Id}"); }); }));
Hi, @Ali-YousefiTelori. There is no way to get entity in C# code, because trigger performs in a DB, this library only creates this trigger.
Is there a way to get Entity in my c# code that inserted, updated, or deleted? for example, I want to get that entity in the trigger action: