public bool SchemaExists(DbConnection cn, string catalogName, string schemaName) { if (cn == null) throw new ArgumentNullException("cn"); if (catalogName == null) throw new ArgumentNullException("catalogName"); if (catalogName.Length == 0) throw new ArgumentException("catalogName"); if (schemaName == null) throw new ArgumentNullException("schemaName"); if (schemaName.Length == 0) throw new ArgumentException("schemaName"); return (cn.ImmediateExecuteSingleOrDefault<string>( FormatSchemaExistsQuery(catalogName, schemaName) , (DbDataReader reader) => { return reader.GetValueOrDefault(0, (string)null); }) != null); }