I'm trying to select count for a superclass that has a lot of records. The select is joining all the subclasses( about 4 tables) that inherit from the super.
I use Fluent NHibernate to map the classes with SubClassMap.
How can I select only the superclass?
Thanks in advance!
setup:
/*------------------------------------------------------
CLASSES
------------------------------------------------------*/
public class Subscriber
{
public virtual Guid Id {get;set;}
public virutal string UserName {get;set;}
}
public class Organization : Subscriber
{
public virtual string Name {get;set;}
}
I'm trying this to get the count of subscribers where Subscriber.username = variable..
/*------------------------------------------------------
DAL
------------------------------------------------------*/
var count = session.CreateCriteria<Subscriber>()
.Add(Restrictions.Eq("WwwUsername", login))
.SetProjection(Projections.Count("WwwUsername")).UniqueResult();