Beispiel #1
0
        public DbHelper(BaseConfig config)
        {
            this.Config = config;
            DbColumnList = GetDbColumns(Config.ConnectionString, Config.DbDataBase, Config.TableName, null);
            FilterDbColumnList = Filter(DbColumnList, Config.NoExistFields);

            var tmp = DbColumnList.Where(p => p.IsPrimaryKey || p.ToString().ToLower().IndexOf("pkid") > -1);
            if (tmp == null || tmp.Count() <= 0)
            {
                PrimaryKey = DbColumnList.First().ColumnName;
            }
            else
            {
                PrimaryKey = DbColumnList.Where(p => p.IsPrimaryKey || p.ToString().ToLower().IndexOf("pkid") > -1).First().ColumnName;
            }
            ClassName = Config.TableName.Replace("_TBL", "").ToUpper();
            TableCommit = GetDbTables(Config.ConnectionString, Config.DbDataBase, Config.TableName)[0].Commit;
        }