Browse Source

Audit log module improvements

pull/395/head
Yunus Emre Kalkan 8 years ago
parent
commit
04abbf3ddb
  1. 9
      modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AbpAuditLoggingDomainSharedModule.cs
  2. 2
      modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs
  3. 2
      modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/EntityPropertyChange.cs
  4. 26
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/AbpAuditLoggingEfCoreQueryableExtensions.cs
  5. 2
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs
  6. 6
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs

9
modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AbpAuditLoggingDomainSharedModule.cs

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

2
modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs

@ -38,7 +38,7 @@ namespace Volo.Abp.AuditLogging
public virtual string Comments { get; protected set; } 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; } public virtual Dictionary<string, object> ExtraProperties { get; protected set; }

2
modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/EntityPropertyChange.cs

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

26
modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/AbpAuditLoggingEfCoreQueryableExtensions.cs

@ -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);
}
}
}

2
modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs

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

6
modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.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