Esempio n. 1
0
        public virtual IAudienceState ToAudienceState()
        {
            var state = new AudienceState(true);

            state.ClientId     = this.ClientId;
            state.Name         = this.Name;
            state.Base64Secret = this.Base64Secret;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
Esempio n. 2
0
        public virtual void Initialize(IAudienceStateCreated stateCreated)
        {
            var aggregateId = stateCreated.AudienceEventId.ClientId;
            var state       = new AudienceState();

            state.ClientId = aggregateId;
            var aggregate = (AudienceAggregate)GetAudienceAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Esempio n. 3
0
 public static CreateAudience ToCreateAudience(this AudienceState state)
 {
     return(state.ToCreateAudience <CreateAudience>());
 }
Esempio n. 4
0
 public static MergePatchAudience ToMergePatchAudience(this AudienceState state)
 {
     return(state.ToMergePatchAudience <MergePatchAudience>());
 }
Esempio n. 5
0
 public static DeleteAudience ToDeleteAudience(this AudienceState state)
 {
     return(state.ToDeleteAudience <DeleteAudience>());
 }
Esempio n. 6
0
 public static IAudienceCommand ToCreateOrMergePatchAudience(this AudienceState state)
 {
     return(state.ToCreateOrMergePatchAudience <CreateAudience, MergePatchAudience>());
 }