On...Updated, On...Created, On...Deleted

Hello radzen team,
is it possible that you enhance the code generator to add
OnAfter...Updated, OnAfter...Created, OnAfter...Deleted partial Method Calls in the Service Class?
I have several things to do in the database after an Update,Create or Delete on specific entities has happened. For now it is only possible to do things before the Database action

Example for Explanation:

partial void OnProjektPositionUpdated(Models.Trentdb.ProjektPosition item);
partial void OnAfterProjektPositionUpdated(Models.Trentdb.ProjektPosition item);

public async Task<Models.Trentdb.ProjektPosition> UpdateProjektPosition(int? projektPositionId, Models.Trentdb.ProjektPosition projektPosition)
{
OnProjektPositionUpdated(projektPosition);

var item = context.ProjektPositions
                  .Where(i => i.ProjektPositionId == projektPositionId)
                  .FirstOrDefault();
if (item == null)
{
   throw new Exception("Item no longer available");
}
var entry = context.Entry(item);
entry.CurrentValues.SetValues(projektPosition);
entry.State = EntityState.Modified;
context.SaveChanges();

OnAfterProjektPositionUpdated(projektPosition);

return projektPosition;

}

Kind Regards
Thomas

Yes, this makes sense and has been requested before. We will add it soon.

1 Like

Great! This is very helpful!

Thanks!

Thomas

Implemented in the latest Radzen release.

1 Like

Works great!
Thank you for that Implementation. It saves a lot of work.

Thomas

Thanks this is huge win!