Verena Praher
Verena Praher

Reputation: 1272

Why can't I call BuildSessionFactory since the update from NHibernate 2 to 3.3.1?

Today I updated my project to NHibernate 3.3 and replaced the NHibernate and the Iesi.Collections References.

I kept NHibernate.ByteCode.Castle I removed the line <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> from my application config. Now I get the error NotSupportedException in the last line of the following code:

NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
cfg.AddAssembly(Assembly.GetExecutingAssembly());
sessionFactory = cfg.BuildSessionFactory();

I googled a lot but I don't have a clue what's wrong. And ideas? Thanks!

my config:

  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
  <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
  <property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>
  <property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
  <property name="connection.connection_string">Server=myserverip;Port=myport;database=my_test;User Id=my_user;Password=mypwd;CommandTimeout=1;</property>
  <!--<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>-->
  <property name="command_timeout">0</property>
</session-factory>

Upvotes: 1

Views: 1476

Answers (1)

tonic
tonic

Reputation: 31

Just add this line to your xml config

<property name="hbm2ddl.keywords">none</property>

More details described here: C# / Postgres / FluentNHibernate : configuring npgsql throws NotSupportedException

Upvotes: 3

Related Questions