protected virtual IAttributeStateCreated Map(ICreateAttribute c) { var stateEventId = new AttributeStateEventId(c.AttributeId, c.Version); IAttributeStateCreated e = NewAttributeStateCreated(stateEventId); e.Name = c.Name; e.OrganizationId = c.OrganizationId; e.Description = c.Description; e.IsMandatory = c.IsMandatory; e.IsInstanceAttribute = c.IsInstanceAttribute; e.AttributeValueType = c.AttributeValueType; e.AttributeValueLength = c.AttributeValueLength; e.IsList = c.IsList; e.FieldName = c.FieldName; e.ReferenceId = c.ReferenceId; e.Active = c.Active; ReflectUtils.CopyPropertyValue("CommandId", c, e); e.CreatedBy = (string)c.RequesterId; e.CreatedAt = DateTime.Now; var version = c.Version; foreach (ICreateAttributeValue innerCommand in c.AttributeValues) { ThrowOnInconsistentCommands(c, innerCommand); IAttributeValueStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddAttributeValueEvent(innerEvent); } return(e); }
protected virtual IAttributeStateCreated Map(ICreateAttribute c) { var stateEventId = new AttributeEventId(c.AttributeId, c.Version); IAttributeStateCreated e = NewAttributeStateCreated(stateEventId); e.AttributeName = c.AttributeName; e.OrganizationId = c.OrganizationId; e.Description = c.Description; e.IsMandatory = c.IsMandatory; e.AttributeValueType = c.AttributeValueType; e.AttributeValueLength = c.AttributeValueLength; e.IsList = c.IsList; e.FieldName = c.FieldName; e.ReferenceId = c.ReferenceId; e.Active = c.Active; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (ICreateAttributeValue innerCommand in c.AttributeValues) { ThrowOnInconsistentCommands(c, innerCommand); IAttributeValueStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddAttributeValueEvent(innerEvent); } foreach (ICreateAttributeAlias innerCommand in c.Aliases) { ThrowOnInconsistentCommands(c, innerCommand); IAttributeAliasStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddAttributeAliasEvent(innerEvent); } return(e); }