public virtual void When(IAttributeSetInstanceExtensionFieldGroupStateCreated e) { ThrowOnWrongEvent(e); this.FieldType = e.FieldType; this.FieldLength = e.FieldLength; this.FieldCount = (e.FieldCount != null && e.FieldCount.HasValue) ? e.FieldCount.Value : default(int); this.NameFormat = e.NameFormat; this.Description = e.Description; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IAttributeSetInstanceExtensionFieldStateCreated innerEvent in e.AttributeSetInstanceExtensionFieldEvents) { IAttributeSetInstanceExtensionFieldState innerState = this.Fields.Get(innerEvent.GlobalId.Index); innerState.Mutate(innerEvent); } }
public virtual void When(IAttributeSetInstanceExtensionFieldGroupStateMergePatched e) { ThrowOnWrongEvent(e); if (e.FieldType == null) { if (e.IsPropertyFieldTypeRemoved) { this.FieldType = default(string); } } else { this.FieldType = e.FieldType; } if (e.FieldLength == null) { if (e.IsPropertyFieldLengthRemoved) { this.FieldLength = default(int?); } } else { this.FieldLength = e.FieldLength; } if (e.FieldCount == null) { if (e.IsPropertyFieldCountRemoved) { this.FieldCount = default(int); } } else { this.FieldCount = (e.FieldCount != null && e.FieldCount.HasValue) ? e.FieldCount.Value : default(int); } if (e.NameFormat == null) { if (e.IsPropertyNameFormatRemoved) { this.NameFormat = default(string); } } else { this.NameFormat = e.NameFormat; } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.Active == null) { if (e.IsPropertyActiveRemoved) { this.Active = default(bool); } } else { this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); } this.UpdatedBy = e.CreatedBy; this.UpdatedAt = e.CreatedAt; foreach (IAttributeSetInstanceExtensionFieldStateEvent innerEvent in e.AttributeSetInstanceExtensionFieldEvents) { IAttributeSetInstanceExtensionFieldState innerState = this.Fields.Get(innerEvent.GlobalId.Index); innerState.Mutate(innerEvent); var removed = innerEvent as IAttributeSetInstanceExtensionFieldStateRemoved; if (removed != null) { this.Fields.Remove(innerState); } } }
protected internal virtual void Apply(IEvent e) { OnApplying(e); _state.Mutate(e); _changes.Add(e); }