Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
 public static CreateAttributeValue ToCreateAttributeValue(this AttributeValueState state)
 {
     return(state.ToCreateAttributeValue <CreateAttributeValue>());
 }
Ejemplo n.º 4
0
 public static MergePatchAttributeValue ToMergePatchAttributeValue(this AttributeValueState state)
 {
     return(state.ToMergePatchAttributeValue <MergePatchAttributeValue>());
 }
Ejemplo n.º 5
0
 public static RemoveAttributeValue ToRemoveAttributeValue(this AttributeValueState state)
 {
     return(state.ToRemoveAttributeValue <RemoveAttributeValue>());
 }
Ejemplo n.º 6
0
 public static IAttributeValueCommand ToCreateOrMergePatchAttributeValue(this AttributeValueState state)
 {
     return(state.ToCreateOrMergePatchAttributeValue <CreateAttributeValue, MergePatchAttributeValue>());
 }