wolli wrote:
Ah, missed that in the first post:
ISessionFactory factory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();
is not enough. YOu have to somehow register the classes, either via the assembly (therefore you need "Embedded Resource") or each file on its own. You can do this in your code
http://nhforge.org/doc/nh/en/index.html#configuration-programmaticor in the config file:
<session-factory>
... <!-- mapping a whole assembly -->
<mapping assembly="QuickStart" />
<!-- mappiong each mapping file -->
<mapping resource="NHibernate.Auction.Item.hbm.xml" assembly="NHibernate.Auction" />
<mapping resource="NHibernate.Auction.Bid.hbm.xml" assembly="NHibernate.Auction" />
</session-factory>
I just corrected my web.config file as you adviced me
Code:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
<property name="connection.driver_class">
NHibernate.Driver.SqlClientDriver
</property>
<property name="connection.connection_string">
Server=(local)\SQLEXPRESS; Database=HibernateCollaborator; Integrated Security=true; Pooling=true
</property>
<property name="dialect">
NHibernate.Dialect.MsSql2005Dialect
</property>
<property name="show_sql">
false
</property>
<mapping assembly="QuickStart" />
<mapping resource="HibernateCollaborator.Data.User.hbm.xml" assembly="HibernateCollaborator.Data" />
</session-factory>
</hibernate-configuration>
but throwed another exception
Could not add assembly QuickStart