Sometimes I really start wondering what's going on in my sourcecode: I'm trying to connect to PostGres 9.0 using npgsql 2.0.11.0, which I'm damn sure I already did, but right now, my program throws a NotSupportedException as it steps into the following :
ISessionFactory sf = Fluently.Configure()
.Database(PostgreSQLConfiguration.PostgreSQL82
.ConnectionString(c => c
.Host("localhost")
.Port(5432)
.Database("cw")
.Username("cw")
.Password("mypass")))
.Mappings(x => x.FluentMappings.AddFromAssemblyOf<MyMapping>())
.BuildSessionFactory();
The Stacktrace is quite neat to look at: Just one line.
at NHibernate.Dialect.Dialect.GetDataBaseSchema(DbConnection connection) in d:\CSharp\NH\nhibernate\src\NHibernate\Dialect\Dialect.cs:Line 718.
I tried transcribing this to the following:
ISessionFactory sf = Fluently.Configure()
.Database(PostgreSQLConfiguration.PostgreSQL82
.ConnectionString(c => c.Is("Server=localhost;Port=5432;Database=cw;User Id=cw;Password=myPass;")))
.Mappings(x => x.FluentMappings.AddFromAssemblyOf<CardTemplateMapping>())
.BuildSessionFactory();
Still, the result's the same. Anybody had similar issues or - even better - a fix?
I guess I'll end up holding a record for the most self-answered questions.
It needed the hbm2ddl.keywords property set to none. Now it works like a charm. Cheers!
See that you already found a solution. So just for some background:
The "none" will disable any operation regarding RDBMS KeyWords.
And the Keywords is available for MsSQL, Oracle, Firebird, MsSqlCe, MySQL, SQLite, SybaseAnywhere.
Since Postgress is not in the list it has to be set to None.
There is som info on it here: Quoting column names with NHibernate and PostgreSQL