I have a class that is mapped to a table using NHibernate. The problem is that only some of the properties are mapped to columns in the table. This is fine because the only columns we use for display are mapped, however I was wondering if there is any way to query against other columns in the table that aren't mapped to properties in my class.
For example we have a table with the following columns:
Customer
-----------
CustomerId
Name
DateCreated
and we have an object
public class Customer
{
public virtual int CustomerId {get;set;}
public virtual string name {get;set;}
}
and name
and customerId
are mapped however DateCreated
is not because we never display it anywhere. We would like to query the Customer
table for customers that were created by a certain date. Is there any way to do this without mapping the DateCreated
? Also it would be preferable to do this using the criteria API.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…