Esempio n. 1
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="NamespaceItems">The namespace items.</param>
        /// <returns></returns>
        public static MetaFieldCollection GetList(params string[] namespaceItems)
        {
            #region ArgumentNullExceptions
            if (namespaceItems == null)
            {
                throw new ArgumentNullException("NamespaceItems", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            }
            #endregion

            MetaFieldCollection retVal = new MetaFieldCollection();

            foreach (string Namespace in namespaceItems)
            {
                using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaFieldByNamespace"),
                                                                      new SqlParameter("@Namespace", Namespace), new SqlParameter("@Deep", false)))
                {
                    while (reader.Read())
                    {
                        retVal.Add(MetaField.Load(reader));
                    }
                }
            }

            return(retVal);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="metaClass">The meta class.</param>
        /// <returns></returns>
        internal static MetaFieldCollection GetList(MetaClass metaClass)
        {
            #region ArgumentNullExceptions
            if (metaClass == null)
            {
                throw new ArgumentNullException("metaClass", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            }
            #endregion

            MetaFieldCollection retVal = new MetaFieldCollection();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaFieldListByMetaClassId"),
                                                                  new SqlParameter("@MetaClassId", metaClass.Id)))
            {
                while (reader.Read())
                {
                    MetaField newItem = MetaField.Load(metaClass, reader);
                    newItem.SetOwnerMetaClass(metaClass);

                    retVal.Add(newItem);
                }
                reader.Close();
            }

            return(retVal);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <returns></returns>
        public static MetaFieldCollection GetList()
        {
            MetaFieldCollection retVal = new MetaFieldCollection();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaFieldList")))
            {
                while (reader.Read())
                {
                    MetaField newItem = MetaField.Load(reader);
                    retVal.Add(newItem);
                }
                reader.Close();
            }

            return(retVal);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="metaClass">The meta class.</param>
        /// <returns></returns>
        internal static MetaFieldCollection GetList(MetaClass metaClass)
        {
            #region ArgumentNullExceptions
            if (metaClass == null)
                throw new ArgumentNullException("metaClass", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            #endregion

            MetaFieldCollection retVal = new MetaFieldCollection();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaFieldListByMetaClassId"),
                      new SqlParameter("@MetaClassId", metaClass.Id)))
            {
                while (reader.Read())
                {
                    MetaField newItem = MetaField.Load(metaClass, reader);
                    newItem.SetOwnerMetaClass(metaClass);

                    retVal.Add(newItem);
                }
                reader.Close();
            }

            return retVal;
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="NamespaceItems">The namespace items.</param>
        /// <returns></returns>
        public static MetaFieldCollection GetList(params string[] namespaceItems)
        {
            #region ArgumentNullExceptions
            if (namespaceItems == null)
                throw new ArgumentNullException("NamespaceItems", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            #endregion

            MetaFieldCollection retVal = new MetaFieldCollection();

            foreach (string Namespace in namespaceItems)
            {
                using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaFieldByNamespace"),
                          new SqlParameter("@Namespace", Namespace), new SqlParameter("@Deep", false)))
                {
                    while (reader.Read())
                    {
                        retVal.Add(MetaField.Load(reader));
                    }
                }
            }

            return retVal;
        }
Esempio n. 6
0
        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <returns></returns>
        public static MetaFieldCollection GetList()
        {
            MetaFieldCollection retVal = new MetaFieldCollection();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaFieldList")))
            {
                while (reader.Read())
                {
                    MetaField newItem = MetaField.Load(reader);
                    retVal.Add(newItem);
                }
                reader.Close();
            }

            return retVal;
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the meta field list.
        /// </summary>
        /// <param name="Namespace">The namespace.</param>
        /// <param name="Deep">if set to <c>true</c> [deep].</param>
        /// <returns></returns>
        public MetaFieldCollection GetMetaFieldList(string metaNamespace, bool deep)
        {
            #region ArgumentNullExceptions
            if (metaNamespace == null)
                throw new ArgumentNullException("Namespace", AsyncResources.GetConstantValue("ARG_NULL_ERR_MSG"));
            #endregion

            string NamespaceFormat = string.Format("{0}.", metaNamespace);

            MetaFieldCollection retVal = new MetaFieldCollection();
            foreach (MetaField item in this.MetaFields)
            {
                if (deep)
                {
                    if (string.Compare(item.Namespace, metaNamespace, true) == 0 || item.Namespace.StartsWith(NamespaceFormat))
                        retVal.Add(item);
                }
                else
                {
                    if (string.Compare(item.Namespace, metaNamespace, true) == 0)
                        retVal.Add(item);
                }
            }

            return retVal;
        }