From 8fc51685b8a3056a52a920e08a0a890422cc29cc Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Tue, 13 Feb 2018 20:07:05 +0100 Subject: [PATCH] Fixed the resoling of app ids. --- .../Contents/ContentOperationContext.cs | 10 ++++++---- .../Commands/DomainObjectBase.cs | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs b/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs index 8660af246..fdbcd0386 100644 --- a/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs +++ b/src/Squidex.Domain.Apps.Entities/Contents/ContentOperationContext.cs @@ -31,6 +31,7 @@ namespace Squidex.Domain.Apps.Entities.Contents private IScriptEngine scriptEngine; private ISchemaEntity schemaEntity; private IAppEntity appEntity; + private Guid appId; private Func message; public static async Task CreateAsync( @@ -56,6 +57,7 @@ namespace Squidex.Domain.Apps.Entities.Contents var context = new ContentOperationContext { appEntity = appEntity, + appId = a.Id, assetRepository = assetRepository, contentRepository = contentRepository, content = content, @@ -88,11 +90,11 @@ namespace Squidex.Domain.Apps.Entities.Contents new ValidationContext( (contentIds, schemaId) => { - return QueryContentsAsync(content.Snapshot.AppId.Id, schemaId, contentIds); + return QueryContentsAsync(schemaId, contentIds); }, assetIds => { - return QueryAssetsAsync(content.Snapshot.AppId.Id, assetIds); + return QueryAssetsAsync(assetIds); }); if (partial) @@ -111,12 +113,12 @@ namespace Squidex.Domain.Apps.Entities.Contents } } - private async Task> QueryAssetsAsync(Guid appId, IEnumerable assetIds) + private async Task> QueryAssetsAsync(IEnumerable assetIds) { return await assetRepository.QueryAsync(appId, new HashSet(assetIds)); } - private async Task> QueryContentsAsync(Guid appId, Guid schemaId, IEnumerable contentIds) + private async Task> QueryContentsAsync(Guid schemaId, IEnumerable contentIds) { return await contentRepository.QueryNotFoundAsync(appId, schemaId, contentIds.ToList()); } diff --git a/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs b/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs index c4d0e0ef4..888c9ff9f 100644 --- a/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs +++ b/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs @@ -52,6 +52,8 @@ namespace Squidex.Infrastructure.Commands ApplyEvent(@event); + snapshot.Version++; + uncomittedEvents.Add(@event); }