コード例 #1
0
 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));
     }
 }
コード例 #2
0
 public static List <SqlColumnSchema> GetSqlColumnSchemas(this SqlConnection sqlConnection, SqlColumnSchema schemaRestriction)
 {
     return(SqlSchemaReader.GetSqlColumnSchemas(sqlConnection, schemaRestriction));
 }
コード例 #3
0
ファイル: SqlSchemaReader.cs プロジェクト: nttrdb/Reusable
        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());
            }
        }