default_catalog is not used in create table
Description
Environment
None
Activity
Show:
Fixed
Details
Details
Assignee
Unassigned
UnassignedReporter
Stefan Steinegger
Stefan SteineggerComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created August 11, 2008 at 9:50 AM
Updated December 16, 2008 at 10:36 AM
Resolved December 16, 2008 at 10:36 AM
Who's Looking?
When using SchemaExport, NHibernate creates a script that uses the default_catalog mostly - except for create table.
If a default catalog is not defined in the connect string, the tables will be created in the master catalog.
In my opinion this is a bug because it first checks if the table exists in the default_catalog, and creates it in the master catalog afterwards. (At least with SqlServer 2000 and 2005). This is inconsistent.
For me it is an important feature. I create the database and the tables from scratch in the unit tests. The database could be changed (we use SQLServer and SqlLite, probably Oracle sometime) by just exchanging the cfg.xml file. I connect to the database using the connect string in the cfg.xml, actually by using the SessionFactory.ConnectionProvider. The connect string must therefore not include the default catalog, because it is not yet created. Then I create the catalog (create database) and the tables (schema export). Everything would work fine ... if the scripts would take the default catalog into account.
I believe it's in Table.cs, line 392, where only the default_schema is passed as argument.