Hi all, I am having trouble using NHibernate in a multi tier application. I am trying to have the following: - Data Access Layer - Class Library - Business Logic - Presentation Layer
What I am thinking and what I have done already is the following: - I have the Persistent Manager class in my Data Access Layer and I am trying to put my mapping files in here too. - Class Library only has my class definitions. For example, public class Customer - Business Logic will have classes that extend the classes found in my Class Library (avoids circular referencing). - Presentation Layer simply displays data.
I am getting the following error, No persister for ClassLibrary.Customer.
I tried moving the Customer.hbm.xml file to my ClassLibrary project but still no luck.
My Customer.hbm.xml file: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="ClassLibrary" assembly="ClassLibrary"> <class name="ClassLibrary.Customer, ClassLibrary" table="Customer" lazy="false"> <id name="CustomerID"> <column name="CustomerID" /> <generator class="identity" /> </id> <property name="DateModified" /> <property name="CustomerName" /> </class> </hibernate-mapping>
My class file (this is in a project called ClassLibrary): namespace ClassLibrary { public class Customer { public DateTime DateModified { get; set; } public String CustomerName { get; set; } public int CustomerID { get; set; } } }
I would appreciate any help on the matter as I am going round in circles at the moment. It all works when I place it in the single project but ideally I want to place it in seperate projects (multi tier application).
Thanks everyone.
|