hitch wrote:
I have an abstract class which has two concrete implementations.
I need to be able to retrieve the abstract class because users will only provide an id/code, which is not type specific, however in my service layer (above business layer), I need to be able to determine the type of the abstract class so that I can carry out some conditional logic.
Is there any other way to determine the type of the class, apart from using NHibernate.NHibernateUtil.GetClass()?
The type of the entity at this point when I call GetType is always the abstract type, even though intellisense within the IDE displays the proper concrete type.
well, actually, in some instances it does return the correct type, and other instances it doesn't.
I'd prefer not to have to let my service layer know about NHibernate...
I think you need something like that:
Code:
if (object.GetType().Equals(typeof(MyClass)))
{
}
cya