I'm done configuring the Fluent NHibernate application using multiple databases. When I run the application, I see that the session is creating the same tables in all the databases. I tried limiting the creation by using the following line of code in Mapping class
Schema("Monkey") <- in monkey ClassMap
Schema("Banana") <- in Banana ClassMap
The SQL Query Generated:
if exists (select * from dbo.sysobjects where id = object_id(N'Banana.[Banan
a]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Banana.[Banana]
if exists (select * from dbo.sysobjects where id = object_id(N'Monkey.[Monke
y]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table Monkey.[Monkey]
create table Banana.[Banana] (
Id INT IDENTITY NOT NULL,
Color NVARCHAR(255) null,
primary key (Id)
)
At the above point the debugger caught an error saying:
The specified schema name "Banana" either does not exist or you do not have permission to use it.