I'm looking to track my modified database entries following this blog post.
I have this class:
[DisplayName("PrettyNameForClass")]
public class UglyClassName
{
...
}
And when I'm saving down the I would like to save down the PrettyNameForClass
instead of the ClassName
.
The code used to get the ClassName
The code I'm currently using:
var modifiedEntities = ChangeTracker.Entries()
.Where(p => p.State == EntityState.Modified).ToList();
foreach (var change in modifiedEntities)
{
var entityName = change.Entity.GetType().Name;
var primaryKey = GetPrimaryKeyValue(change);