Audit log module improvements

pull/395/head
Yunus Emre Kalkan 7 years ago
parent 988894960e
commit 04abbf3ddb

@ -1,4 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
namespace Volo.Abp.AuditLogging
@ -7,6 +9,13 @@ namespace Volo.Abp.AuditLogging
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.Configure<AbpLocalizationOptions>(options =>
{
options.Resources.Add<AuditLoggingResource>("en");
});
context.Services.AddAssemblyOf<AbpAuditLoggingDomainSharedModule>();
}
}

@ -38,7 +38,7 @@ namespace Volo.Abp.AuditLogging
public virtual string Comments { get; protected set; }
public int? HttpStatusCode { get; set; }
public virtual int? HttpStatusCode { get; set; }
public virtual Dictionary<string, object> ExtraProperties { get; protected set; }

@ -9,7 +9,7 @@ namespace Volo.Abp.AuditLogging
[DisableAuditing]
public class EntityPropertyChange : Entity<Guid>, IMultiTenant
{
public Guid? TenantId { get; protected set; }
public virtual Guid? TenantId { get; protected set; }
public virtual Guid EntityChangeId { get; protected set; }

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.EntityFrameworkCore;
namespace Volo.Abp.AuditLogging
{
public static class AbpAuditLoggingEfCoreQueryableExtensions
{
public static IQueryable<AuditLog> IncludeDetails(
this IQueryable<AuditLog> queryable,
bool include = true)
{
if (!include)
{
return queryable;
}
return queryable
.Include(x => x.Actions)
.Include(x => x.EntityChanges);
}
}
}

@ -73,7 +73,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
b.Property(x => x.AuditLogId).IsRequired().HasColumnName(nameof(EntityChange.AuditLogId));
b.Property(x => x.ChangeTime).IsRequired().HasColumnName(nameof(EntityChange.ChangeTime));
b.Property(x => x.ChangeType).IsRequired().HasColumnName(nameof(EntityChange.ChangeType));
b.Property(x => x.TenantId).IsRequired().HasColumnName(nameof(EntityChange.TenantId));
b.Property(x => x.TenantId).HasColumnName(nameof(EntityChange.TenantId));
b.HasMany<EntityPropertyChange>().WithOne().HasForeignKey(x => x.EntityChangeId);

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
@ -11,5 +12,10 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
{
}
public override IQueryable<AuditLog> WithDetails()
{
return GetQueryable().IncludeDetails();
}
}
}

Loading…
Cancel
Save