I don't think that there is way other than sql to do what you want.

On Mon, Oct 24, 2011 at 18:07, brandon law <[email protected]> wrote:

> 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();
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to