I have a class, Order, which I persist to a database using NHibernate. There is a folder futher down in the web application that contains an object that inherits from Order, for our purposes, we can call it CustomOrder. I use CustomOrder to place a few properties onto the Order object for UI purposes. The properties don't actually have to be saved to the database.
When I pass the CustomOrder class to my generic save method that just takes in an Order object, NHibernate complains:
Unknown entity class: CustomOrder.
I don't need to persist the custom fields to the database, but I'd like to keep this inheritance structure. Am I thinking in the wrong terms or doing something I shouldn't be doing?
Save Code
public object Save(Order obj, object userID) {
Order o = (Order)obj;
ISession session = NHibernateHelper.GetCurrentSession();
ITransaction tx = session.BeginTransaction();
session.Save(o);
After the case in the first line of the method, .NET still identifies it as CustomerOrder.