c# - Could not compile the mapping document in NHibernate -


the exception is:

could not compile mapping document: windowsformsapplication2.products.hbm.xml

and inner exception is:

persistent class sample.customerservice.domain.products, sample.customerservice. domain not found

my configuration is:

config file ,i not paste here because of error ,i did not accept code hare put link here

and mapping file.

and class mapping is

namespace sample.customerservice.domain {     public class product     {         public virtual int productid { get; set; }         public virtual string name { get; set; }     } } 

and session factory is

public sealed class sessionfactory {            private static volatile isessionfactory isessionfactory;     private static object syncroot = new object();      public static isession opensession     {                 {             if (isessionfactory == null)             {                 lock (syncroot)                 {                     if (isessionfactory == null)                     {                         configuration configuration = new configuration();                         configuration.addassembly(assembly.getcallingassembly());                         isessionfactory = configuration.buildsessionfactory();                     }                 }             }             return isessionfactory.opensession();         }     } }  

when try record code

using (isession session = sessionfactory.opensession) {     iquery query = session.createquery("from products");     ilist<products> pinfos = query.list<products>();     dgview.datasource = pinfos; } 

it gives me error not compile mapping document explained above. new hibernate, added hibernte nugget.org manage nugget pcakage option in visual studio 2012, added 2 dlls nhhibernate , iesi.collections. please me fix error, gave info in knowledge.

in mapping have products, , class named product (in singular). should be:

<class name="product" table="products" lazy="true"> 

btw, lazy default nhibernate can omit in mapping. if chance table name same class name can omit too, practice keep mapping file content @ minimun necesary.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -