public static List <SqlColumnSchema> GetSqlColumnSchemas(this ISqlSchemaReader reader, string connectionString, SqlColumnSchema schemaRestriction)
 {
     using (var sqlConnection = new SqlConnection(connectionString).Then(c => c.Open()))
     {
         return(reader.GetSqlColumnSchemas(sqlConnection, schemaRestriction));
     }
 }
Example #2
0
 public static List <SqlColumnSchema> GetSqlColumnSchemas(this SqlConnection sqlConnection, SqlColumnSchema schemaRestriction)
 {
     return(SqlSchemaReader.GetSqlColumnSchemas(sqlConnection, schemaRestriction));
 }
Example #3
0
        public List <SqlColumnSchema> GetSqlColumnSchemas(SqlConnection sqlConnection, SqlColumnSchema schemaRestriction)
        {
            if (sqlConnection == null)
            {
                throw new ArgumentNullException(nameof(sqlConnection));
            }
            if (schemaRestriction == null)
            {
                throw new ArgumentNullException(nameof(schemaRestriction));
            }

            using (var schema = sqlConnection.GetSchema(SqlSchemaCollection.Columns, schemaRestriction))
            {
                return(schema.AsEnumerable().Select(SqlSchemaFactory.Create <SqlColumnSchema>).ToList());
            }
        }