Exemple #1
0
    static Contracts.AggregateRoot ToProtobuf(AggregateRootWithTenantScopedInstances aggregateRoot)
    {
        var result = new Contracts.AggregateRoot
        {
            Alias          = aggregateRoot.AggregateRoot.Alias,
            AggregateRoot_ = aggregateRoot.AggregateRoot.Identifier.ToProtobuf(),
        };

        result.EventSources.AddRange(aggregateRoot.Aggregates.Select(_ => new TenantScopedEventSource
        {
            TenantId             = _.Tenant.ToProtobuf(),
            AggregateRootVersion = _.Instance.Version,
            EventSourceId        = _.Instance.EventSource
        }));
        return(result);
    }
 static bool WithAlias(AggregateRootWithTenantScopedInstances root, AggregateRootIdOrAlias idOrAlias)
 => !root.AggregateRoot.Alias.Equals(AggregateRootAlias.NotSet) && root.AggregateRoot.Alias.Equals(idOrAlias.Alias);