AutoHistory icon indicating copy to clipboard operation
AutoHistory copied to clipboard

Enhancement: Needs ExcludeFromHistory property, for fields.

Open BrianMinister opened this issue 6 years ago • 6 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="")]

BrianMinister avatar Nov 04 '18 09:11 BrianMinister

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

rigofunc avatar Nov 04 '18 11:11 rigofunc

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.

BrianMinister avatar Nov 05 '18 09:11 BrianMinister

Thanks for the gr8 job. Can we also have a feature to exclude a whole DbSet<X>? 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.

tohidazizi avatar Dec 11 '18 07:12 tohidazizi

When release new version, this should be supported.

rigofunc avatar Dec 11 '18 09:12 rigofunc

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.

BrianMinister avatar Feb 05 '19 13:02 BrianMinister

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?

coolhome avatar Apr 13 '20 13:04 coolhome