arch / AutoHistory

A plugin for Microsoft.EntityFrameworkCore to support automatically recording data changes history.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement: Needs ExcludeFromHistory property, for fields.

BrianMinister opened this issue · comments

When recording history, there are fields that I don't want their real data recorded in history. These are like Personal Identifying data, or passwords (even after being hashed).

Though making this an extension method that would work in the OnModelCreating call, it would also be nice to see it as an attribute for the model fields themselves.

[ExcludeFromHistory(ReplacementValue="")]

Good idea, this is a real requirement. You can PR for this or I will done this in next release.

I don't know how much time I have to put into this. I'll see if I can work on this this week. Otherwise, Jan 2019.

commented

Thanks for the gr8 job. Can we also have a feature to exclude a whole DbSet? I really don't need history for all the entities.
It is actually would be nice to exclude "all" and then include whatever entities we need history for them.

When release new version, this should be supported.

I started on this, then realized that Newtonsoft's library is being used.
So I am testing using their [JsonIgnore] attribute for the field level access.

I suspect that a whole model implementing this would cover the model, if the serialization code isn't ignoring these attributes.

I had a case where i needed to exclude binary data, however a more advanced feature could be using a hash for the binary data instead of the difference.

I completely agree with an attribute for ExcludeFromHistory. This would be super easy to implement, anyone have a problem if I implement it?