/// <summary>
        /// Gets the authorization attribute.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public IAzManAttribute <IAzManAuthorization> GetAttribute(string key)
        {
            AuthorizationAttributesResult attr;

            if ((attr = (from t in this.db.AuthorizationAttributes() where t.AuthorizationId == this.authorizationId && t.AttributeKey == key select t).FirstOrDefault()) != null)
            {
                IAzManAttribute <IAzManAuthorization> result = new SqlAzManAuthorizationAttribute(this.db, this, attr.AuthorizationAttributeId.Value, attr.AttributeKey, attr.AttributeValue, this.ens);
                if (this.ens != null)
                {
                    this.ens.AddPublisher(result);
                }
                return(result);
            }
            else
            {
                throw SqlAzManException.AttributeNotFoundException(key, this, null);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets the store attribute.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns></returns>
        public IAzManAttribute <IAzManStore> GetAttribute(string key)
        {
            StoreAttributesResult sar;

            if ((sar = (from t in this.db.StoreAttributes() where t.StoreId == this.storeId && t.AttributeKey == key select t).FirstOrDefault()) != null)
            {
                IAzManAttribute <IAzManStore> result = new SqlAzManStoreAttribute(this.db, this, sar.StoreAttributeId.Value, sar.AttributeKey, sar.AttributeValue, this.ens);
                if (this.ens != null)
                {
                    this.ens.AddPublisher(result);
                }
                return(result);
            }
            else
            {
                throw SqlAzManException.AttributeNotFoundException(key, this.name, null);
            }
        }