Nhibernate Get and Load
I'm fixing my codebase using NHibernate and I figured out that instead of using Get or Load to look up objects by ID, they used a query.
Like:
session.CreateCriteria(typeof(T)).Add(Expression.AllEq(propertyNameValues)).List<T>();
where propertyNameValues is an identifier containing an "ID" and an id value.
Trying to replace it with:
session.Get<T>(id);
Nhibernate is throwing No Persister for my class.
But apparently one of them works, my google-fu found links only where people forgot to specify a given hbm for inline resources or a mapping assembly in nhibernate config.
I tried Get (id), Get (typeof (T), id), Get ("ClassName", id) all throwing the same error.
Here is the mapping as requested (thanks)
<class name="Domain.Customers.Customer, Domain" table="Customer" lazy ="true">
<id name="ID" column="id" access="field.lowercase-underscore" type="int">
<generator class="identity" />
</id>
This is one class mapping, but it is common to all of my entitites.
Thanks for any pointer.
a source to share