Exemple #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);
        }
Exemple #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);
            }
        }
 public static CreateAttributeAlias ToCreateAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToCreateAttributeAlias <CreateAttributeAlias>());
 }
 public static MergePatchAttributeAlias ToMergePatchAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToMergePatchAttributeAlias <MergePatchAttributeAlias>());
 }
 public static RemoveAttributeAlias ToRemoveAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToRemoveAttributeAlias <RemoveAttributeAlias>());
 }
 public static IAttributeAliasCommand ToCreateOrMergePatchAttributeAlias(this AttributeAliasState state)
 {
     return(state.ToCreateOrMergePatchAttributeAlias <CreateAttributeAlias, MergePatchAttributeAlias>());
 }