Пример #1
0
        public static TableSchema Create(DbProvider dbProvider, string connectionString, string sql)
        {
            DatabaseCore databaseCore = new DatabaseCore(dbProvider, connectionString);

            DataTable dt = GetTableSchema(databaseCore, sql);

            return new TableSchema(dt);
        }
Пример #2
0
        private static DataTable GetTableSchema(DatabaseCore databaseCore, string sql)
        {
            DataTable dt;

            //
            // reference : http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.GetTableSchema.aspx
            //
            using (DbCommand command = databaseCore.CreateDbCommand())
            {
                command.CommandText = sql;
                using (DbDataReader reader = command.ExecuteReader(CommandBehavior.KeyInfo))
                {
                    dt = reader.GetSchemaTable();
                }
            }

            return dt;
        }
Пример #3
0
 public Database(DbProvider dbProvider, string connectionString)
 {
     _databaseCore = new DatabaseCore(dbProvider, connectionString);
 }