예제 #1
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            AttributeAliasId other = obj as AttributeAliasId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.AttributeId, other.AttributeId) &&
                   Object.Equals(this.Code, other.Code)
                   );
        }
예제 #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);
            }
        }