实现IAuditingStore接口
public class AuditingStore : IAuditingStore
{
private readonly IRepository<Auditlogs, long> _auditLogRepository;
public AuditingStore(IRepository<Auditlogs, long> auditLogRepository)
{
_auditLogRepository = auditLogRepository;
}
public Task SaveAsync(AuditInfo auditInfo)
{
return _auditLogRepository.InsertAsync(Auditlogs.CreateFromAuditInfo(auditInfo));
}
}
public class Auditlogs : Entity<long>, IMayHaveTenant
{ /// <summary>
/// Maximum length of <see cref="ServiceName"/> property.
/// </summary>
prop Name{get;set;
}
///替换默认审计服务实现
Configuration.ReplaceService(typeof(IAuditingStore), () =>
{
IocManager.Register<IAuditingStore, AuditingStore>(DependencyLifeStyle.Transient);
});