示例#1
0
        public virtual IAttributeValueState ToAttributeValueState()
        {
            var state = new AttributeValueState(true);

            state.Value       = this.Value;
            state.Name        = this.Name;
            state.Description = this.Description;
            state.ReferenceId = this.ReferenceId;
            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.AttributeId = this.AttributeId;
            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);
        }
示例#2
0
        public virtual IAttributeValueState Get(string value, bool forCreation, bool nullAllowed)
        {
            AttributeValueId globalId = new AttributeValueId(_attributeState.AttributeId, value);

            if (_loadedAttributeValueStates.ContainsKey(globalId))
            {
                return(_loadedAttributeValueStates[globalId]);
            }
            if (forCreation || ForReapplying)
            {
                var state = new AttributeValueState(ForReapplying);
                state.AttributeValueId = globalId;
                _loadedAttributeValueStates.Add(globalId, state);
                return(state);
            }
            else
            {
                var state = AttributeValueStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedAttributeValueStates.Add(globalId, state);
                }
                return(state);
            }
        }
 public static CreateAttributeValue ToCreateAttributeValue(this AttributeValueState state)
 {
     return(state.ToCreateAttributeValue <CreateAttributeValue>());
 }
 public static MergePatchAttributeValue ToMergePatchAttributeValue(this AttributeValueState state)
 {
     return(state.ToMergePatchAttributeValue <MergePatchAttributeValue>());
 }
 public static RemoveAttributeValue ToRemoveAttributeValue(this AttributeValueState state)
 {
     return(state.ToRemoveAttributeValue <RemoveAttributeValue>());
 }
 public static IAttributeValueCommand ToCreateOrMergePatchAttributeValue(this AttributeValueState state)
 {
     return(state.ToCreateOrMergePatchAttributeValue <CreateAttributeValue, MergePatchAttributeValue>());
 }