I think you can do:

query.Where( () => dogAlias.Name.Contains(dogname));

or .WhereRestrictionOn(() => dogAlias.Name).IsLike("%dogname%")

and so on..



2011/3/5 Jim Geurts <[email protected]>

> As far as I know, the QueryOver api does not allow you reference an
> alias by name, but rather you use a typed object. How can I add a
> restriction to my query that targets the alias?
>
> For example, I would like to accomplish something along the lines of:
>
>
> var query = session.QueryOver<Person>().JoinQueryOver(x => x.Dogs, ()
> => dogAlias);
>
> return query.Where(Restrictions.Disjunction()
>                       .Add(Restrictions.Like("Name", searchQuery,
> MatchMode.Anywhere))
>                       .Add(Restrictions.Like("dogAlias.Name",
> searchQuery, MatchMode.Anywhere)));
>
> --
> 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