I'm using Project Version: 5.1.0 and .Net Core 2.0 framework. I'm trying to implement an Audit/History table for my Entity so that I can see the deleted and old column values for a table.
Entity Class:
[Table("TestingEntity")]
[Audited]
public class TestingEntity : AuditedEntity , IMayHaveTenant
{
public int? TenantId { get; set; }
public virtual string Code { get; set; }
}
ApplicationModule Class:
public class MyCompanyApplicationModule : AbpModule
{
public override void PreInitialize()
{
//Adding authorization providers
Configuration.Authorization.Providers.Add<AppAuthorizationProvider>();
//Adding custom AutoMapper configuration
Configuration.Modules.AbpAutoMapper().Configurators.Add(CustomDtoMapper.CreateMappings);
Configuration.EntityHistory.IsEnabledForAnonymousUsers = true;
Configuration.EntityHistory.Selectors.Add(new NamedTypeSelector("Abp.AuditedEntities", type => typeof(IAudited).IsAssignableFrom(type)));
}
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(typeof(MyCompanyApplicationModule).GetAssembly());
}
}
Running following queries giving no results.
SELECT * FROM [AbpEntityChangeSets]
SELECT * FROM [AbpEntityPropertyChanges]
SELECT * from [AbpEntityChanges]
Referece: [https://aspnetboilerplate.com/Pages/Documents/Entity-History])
5 Answer(s)
-
0
You pass parameter type => typeof(IAudited) but I can not see any entities that is type of IAudited entity. Could you change it with AuditedEntity ? I mean something like following:
Configuration.EntityHistory.Selectors.Add(new NamedTypeSelector("Abp.AuditedEntities", type => typeof(AuditedEntity).IsAssignableFrom(type)));
-
0
Solved the issue, You can refer the below SO link.
[https://stackoverflow.com/a/48768242/6527049])
-
0
Duplicate of #4639@f973889d-ab08-4fb0-8536-37261ecee8a7
-
0
It is not giving proper results when I'm deleting an entity item.
Its inserting records for each property with old and new value same in [AbpEntityPropertyChanges] table.
And there is no clear information that this entity item is deleted and its deletion time, DeletedBy.
Is this due to using AuditeEntity in my Entity class? I'm using hard delete so I thought not to add these columns is deleted and its deletion time, DeletedBy to table.
-
0
I think you got the answer here : <a class="postlink" href="https://stackoverflow.com/questions/48761496/cant-enable-entity-history-in-asp-net-zero">https://stackoverflow.com/questions/487 ... p-net-zero</a>