Esempio n. 1
0
        /// <summary>
        /// Returns the meta types supported by the framework
        /// </summary>
        /// <returns></returns>
        public MetaType[] GetMetaTypeList()
        {
            ArrayList retVal = new ArrayList();

            MetaTypeCollection fullList = MetaType.GetMetaTypes(MDContext);

            foreach (MetaType item in fullList)
            {
                // Skip dictionary types, although they are supported, they typically provide major performance hit and
                // are not recommended

                /*
                 * if (IsDictionaryType(item.MetaDataType))
                 *  continue;
                 *
                 * if (item.MetaDataType == MetaDataType.StringDictionary)
                 *  continue;
                 *
                 * if (item.Name.Contains("Dictionary"))
                 *  continue;
                 * */

                if (!item.IsSqlCommonType ||
                    String.Compare(item.Name, "Boolean", true) == 0 ||
                    String.Compare(item.Name, "Money", true) == 0 ||
                    String.Compare(item.Name, "DateTime", true) == 0 ||
                    String.Compare(item.Name, "Decimal", true) == 0 ||
                    String.Compare(item.Name, "Float", true) == 0)
                {
                    retVal.Add(item);
                }
            }

            return((MetaType[])retVal.ToArray(typeof(MetaType)));
        }
Esempio n. 2
0
        public static MetaTypeCollection GetSqlMetaTypes()
        {
            MetaTypeCollection retVal = new MetaTypeCollection();
            using (SqlDataReader reader = SqlHelper.ExecuteReader(MetaDataContext.Current, CommandType.StoredProcedure, AsyncResources.GetConstantValue("SP_LoadMetaTypeList")))
            {
                while (reader.Read())
                {
                    MetaType newType = MetaType.Load(reader);
                    if (newType.IsSqlCommonType)
                        retVal.Add(newType);
                }
                reader.Close();
            }

            return retVal;
        }