mirror of https://github.com/Squidex/squidex.git
20 changed files with 132 additions and 50 deletions
@ -0,0 +1,26 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using Squidex.Domain.Apps.Events; |
||||
|
using Squidex.Infrastructure.Commands; |
||||
|
using Squidex.Infrastructure.EventSourcing; |
||||
|
|
||||
|
namespace Squidex.Domain.Apps.Entities |
||||
|
{ |
||||
|
public abstract class SquidexDomainObjectBase<T> : DomainObjectBase<T> where T : IDomainState, new() |
||||
|
{ |
||||
|
public override void RaiseEvent(Envelope<IEvent> @event) |
||||
|
{ |
||||
|
if (@event.Payload is AppEvent appEvent) |
||||
|
{ |
||||
|
@event.SetAppId(appEvent.AppId.Id); |
||||
|
} |
||||
|
|
||||
|
base.RaiseEvent(@event); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
using System; |
||||
|
using System.Globalization; |
||||
|
using Squidex.Infrastructure.EventSourcing; |
||||
|
|
||||
|
namespace Squidex.Domain.Apps.Events |
||||
|
{ |
||||
|
public static class SquidexHeaderExtensions |
||||
|
{ |
||||
|
public static Guid AppId(this EnvelopeHeaders headers) |
||||
|
{ |
||||
|
return headers[SquidexHeaders.AppId].ToGuid(CultureInfo.InvariantCulture); |
||||
|
} |
||||
|
|
||||
|
public static Envelope<T> SetAppId<T>(this Envelope<T> envelope, Guid value) where T : class |
||||
|
{ |
||||
|
envelope.Headers.Set(SquidexHeaders.AppId, value); |
||||
|
|
||||
|
return envelope; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
// ==========================================================================
|
||||
|
// Squidex Headless CMS
|
||||
|
// ==========================================================================
|
||||
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
||||
|
// All rights reserved. Licensed under the MIT license.
|
||||
|
// ==========================================================================
|
||||
|
|
||||
|
namespace Squidex.Domain.Apps.Events |
||||
|
{ |
||||
|
public static class SquidexHeaders |
||||
|
{ |
||||
|
public static readonly string AppId = "AppId"; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue