Пример #1
0
        public virtual IAttributeAliasState ToAttributeAliasState()
        {
            var state = new AttributeAliasState(true);

            state.Code = this.Code;
            state.Name = this.Name;
            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 IAttributeAliasState Get(string code, bool forCreation, bool nullAllowed)
        {
            AttributeAliasId globalId = new AttributeAliasId(_attributeState.AttributeId, code);

            if (_loadedAttributeAliasStates.ContainsKey(globalId))
            {
                var state = _loadedAttributeAliasStates[globalId];
                if (this._attributeState != null && this._attributeState.ReadOnly == false)
                {
                    ((IAttributeAliasState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new AttributeAliasState(ForReapplying);
                state.AttributeAliasId = globalId;
                _loadedAttributeAliasStates.Add(globalId, state);
                if (this._attributeState != null && this._attributeState.ReadOnly == false)
                {
                    ((IAttributeAliasState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = AttributeAliasStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedAttributeAliasStates.Add(globalId, state);
                }
                if (this._attributeState != null && this._attributeState.ReadOnly == false)
                {
                    ((IAttributeAliasState)state).ReadOnly = false;
                }
                return(state);
            }
        }
Пример #3
0
 public static CreateAttributeAlias ToCreateAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToCreateAttributeAlias <CreateAttributeAlias>());
 }
Пример #4
0
 public static MergePatchAttributeAlias ToMergePatchAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToMergePatchAttributeAlias <MergePatchAttributeAlias>());
 }
Пример #5
0
 public static RemoveAttributeAlias ToRemoveAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToRemoveAttributeAlias <RemoveAttributeAlias>());
 }
Пример #6
0
 public static IAttributeAliasCommand ToCreateOrMergePatchAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToCreateOrMergePatchAttributeAlias <CreateAttributeAlias, MergePatchAttributeAlias>());
 }