Support forum for ASP.NET Zero (https://aspnetzero.com/).
By RattleHub
#26027 Is it possible to overide the save on the database context. We have a custon attribute that we need to check if the value has the attribute defined and then modify the data. Could you advise me the best way to do this.

We are basically looking to implememnt something like this where we can see if a Encryped attribute is set and then if need be encrypt the data

https://gist.github.com/albertbori/e95860644e69c1572441
User avatar
By aaron
#26042 Yes, you can override SaveChanges().

Are you using EF Core? If yes, then the main difference is:

Code: Select allvar pendingEntities = ChangeTracker.Entries()
    .Where(e => e.State == EntityState.Added || e.State == EntityState.Modified)
    .ToList();

You can try that and let us know what errors you get.