0
devinedon created
Hi,
As a follow up to post #9763, as an alternative option I thought of (but which I can't get to work!) is as follows:
- Create a new DynamicEntityPropertyClass, which also inherits from IFullAudited, and then enable Entity History for FullAuditedEntities
- https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Extending-Existing-Entities
[Audited]
public class MyDynamicEntityProperty : DynamicEntityProperty, IFullAudited
{
public DateTime CreationTime { get; set; }
public long? CreatorUserId { get; set; }
public DateTime? LastModificationTime { get; set; }
public long? LastModifierUserId { get; set; }
public bool IsDeleted { get; set; }
public long? DeleterUserId { get; set; }
public DateTime? DeletionTime { get; set; }
}
Configuration.EntityHistory.Selectors.Add(
new NamedTypeSelector("Abp.FullAuditedEntities", type => typeof(IFullAudited).IsAssignableFrom(type)));
After running the migration to generate the new table with the IFullAudited columns, the relevant columns are not updating e.g. when I add a new entity, the CreationTime and CreatorUserId are still null.
Is the above implementation possible, or am I going down an impossible route?
2 Answer(s)
-
0
Hi,
- Could you also share how do you use MyDynamicEntityProperty in your code ?
- Did you try solution offered in https://support.aspnetzero.com/QA/Questions/9763 ? If so, did that work for you ?
-
0
Hi,
I managed to get this working - thanks for the assistance.