Hi
I am new to NHibernate...
While trying to run the sample given by the documentation, I am getting the following Error..
Unknown entity class: QuickStart.Cat
If I am changing the .hbm file build action property to embedded resource I am getting different error in the line
sessionFactory = new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();
ERROR:
The type initializer for 'QuickStart.NHibernateHelper' threw an exception
Please help me to solve this problem.
Cat.hbm.xml File:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="QuickStart" assembly="QuickStart">
<class name="Cat" table="Cat">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by NHibernate with the UUID pattern. -->
<id name="Id">
<column name="CatId" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex" />
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name">
<column name="Name" length="16" not-null="true" />
</property>
<property name="Sex" />
<property name="Weight" />
</class>
</hibernate-mapping>
Web Config:
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True</property>
<!--<mapping resource="Quickstart.Cat.hbm.xml" assembly="Quickstart" />-->
<mapping assembly="QuickStart"/>
</session-factory>
</hibernate-configuration>
Thanks in advance[/b]
|