コード例 #1
0
        public List <SchemaCategory> CreateStrucuteCategory(HtmlDocument htmlDocument)
        {
            HtmlNode doc = htmlDocument.DocumentNode;
            List <SchemaCategory> mods = new List <SchemaCategory>();

            foreach (HtmlNode item in doc.SelectNodes(@"//table[@class='table']/tbody/tr"))
            {
                SchemaCategory modItem = new SchemaCategory()
                {
                    ParentElement = null,
                    ChildElement  = null,
                };
                mods.Add(modItem);
            }
            ;

            return(mods);
        }
コード例 #2
0
        protected override IEnumerable <T> GetSchemas <T>(IDatabase database, SchemaCategory category, string[] restrictionValues)
        {
            switch (category)
            {
            case SchemaCategory.Table:
                return(GetTables(database, restrictionValues).Cast <T>());

            case SchemaCategory.View:
                return(GetViews(database, restrictionValues).Cast <T>());

            case SchemaCategory.Column:
                return(GetColumns(database, restrictionValues).Cast <T>());

            case SchemaCategory.ForeignKey:
                return(GetForeignKeys(database, restrictionValues).Cast <T>());
            }

            return(base.GetSchemas <T>(database, category, restrictionValues));
        }
コード例 #3
0
 public void Init()
 {
     instance = new SchemaCategory();
 }
コード例 #4
0
        /// <summary>
        /// 返回架构中的元素。
        /// </summary>
        /// <param name="category"></param>
        /// <param name="table">记录架构信息的数据表。</param>
        /// <returns></returns>
        protected IEnumerable ReturnSchemaElements(SchemaCategory category, DataTable table)
        {
            IEnumerable enumer = null;

            switch (category)
            {
            case SchemaCategory.Database:
                enumer = GetDatabases(table, null);
                break;

            case SchemaCategory.Column:
                enumer = GetColumns(table, null);
                break;

            case SchemaCategory.DataType:
                enumer = GetDataTypes(table, null);
                break;

            case SchemaCategory.ForeignKey:
                enumer = GetForeignKeys(table, null);
                break;

            case SchemaCategory.IndexColumn:
                enumer = GetIndexColumns(table, null);
                break;

            case SchemaCategory.Index:
                enumer = GetIndexs(table, null);
                break;

            case SchemaCategory.MetadataCollection:
                enumer = GetMetadataCollections(table, null);
                break;

            case SchemaCategory.ProcedureParameter:
                enumer = GetProcedureParameters(table, null);
                break;

            case SchemaCategory.Procedure:
                enumer = GetProcedures(table, null);
                break;

            case SchemaCategory.ReservedWord:
                enumer = GetReservedWords(table, null);
                break;

            case SchemaCategory.Restriction:
                enumer = GetRestrictions(table, null);
                break;

            case SchemaCategory.Table:
                enumer = GetTables(table, null);
                break;

            case SchemaCategory.User:
                enumer = GetUsers(table, null);
                break;

            case SchemaCategory.ViewColumn:
                enumer = GetViewColumns(table, null);
                break;

            case SchemaCategory.View:
                enumer = GetViews(table, null);
                break;
                //case SchemaCategory.Trigger:
                //    enumer = GetTriggers(table, null);
                //    break;
            }

            return(enumer);
        }