Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into dev

pull/5966/head
Halil İbrahim Kalkan 6 years ago
parent
commit
33ac8f852a
  1. 17
      modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs
  2. 16
      modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs

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

@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -141,9 +142,21 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore
return GetQueryable().IncludeDetails(); return GetQueryable().IncludeDetails();
} }
public Task<EntityChange> GetEntityChange(Guid entityChangeId) public virtual async Task<EntityChange> GetEntityChange(Guid entityChangeId)
{ {
return DbContext.Set<EntityChange>().AsNoTracking().IncludeDetails().OrderBy(x => x.Id).Where(x => x.Id == entityChangeId).FirstAsync(); var entityChange = await DbContext.Set<EntityChange>()
.AsNoTracking()
.IncludeDetails()
.OrderBy(x => x.Id)
.Where(x => x.Id == entityChangeId)
.FirstOrDefaultAsync();
if (entityChange == null)
{
throw new EntityNotFoundException(typeof(EntityChange));
}
return entityChange;
} }
public virtual async Task<List<EntityChange>> GetEntityChangeListAsync( public virtual async Task<List<EntityChange>> GetEntityChangeListAsync(

16
modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using MongoDB.Driver; using MongoDB.Driver;
using MongoDB.Driver.Linq; using MongoDB.Driver.Linq;
using Volo.Abp.Auditing; using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.MongoDB; using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB; using Volo.Abp.MongoDB;
@ -142,10 +143,17 @@ namespace Volo.Abp.AuditLogging.MongoDB
public virtual async Task<EntityChange> GetEntityChange(Guid entityChangeId) public virtual async Task<EntityChange> GetEntityChange(Guid entityChangeId)
{ {
return (await GetMongoQueryable() var entityChange = (await GetMongoQueryable()
.Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId)) .Where(x => x.EntityChanges.Any(y => y.Id == entityChangeId))
.FirstAsync() .FirstAsync()).EntityChanges.FirstOrDefault(x => x.Id == entityChangeId);
).EntityChanges.First(x => x.Id == entityChangeId);
if (entityChange == null)
{
throw new EntityNotFoundException(typeof(EntityChange));
}
return entityChange;
} }
public virtual async Task<List<EntityChange>> GetEntityChangeListAsync( public virtual async Task<List<EntityChange>> GetEntityChangeListAsync(

Loading…
Cancel
Save