hql, linq2nh, your own Or() extension method.

On May 24, 3:55 pm, Hoang Tang <[email protected]> wrote:
> @Jason,
>
> this work as expected thank you!
>
> I wonder if there is another way to do this...
>
> On Mon, May 24, 2010 at 7:37 AM, Jason Meckley <[email protected]>wrote:
>
>
>
> > var enrollments = session
> >        .CreateCriteria<Enrollment>()
> >        .CreateAlias("User", "u")
> >        .Add(new Disjunction()
> >                   .Add(Expression.Like("Name", "Tester"))
> >                   .Add(Expression.Like("u.UserName", "Tester")))
> >        .List();
>
> > On May 24, 6:05 am, Hoang Tang <[email protected]> wrote:
> > > So I got
>
> > > IList enrollments = sess.CreateCriteria(typeof(Enrollment))
> > >    .Add( Expression.Like("Name", "Tester")
> > >    .CreateCriteria("User")
> > >        .Add( Expression.Like("UserName", "Tester") )
> > >    .List();
>
> > > this assume that we got a class Enrollment with that have an
> > > EnrollmentProperty
>
> > > this generate an SQL where clause like this
>
> > > WHERE  (enrollment_.Name like 'Tester')
> > >       *and *(user_.UserName like 'Tester' )
>
> > > how do modify my criteria so the and will become the or? like this
> > > WHERE  (enrollment_.Name like 'Tester') *or *(user_.UserName like
> > 'Tester' )
>
> > > Thanks,
>
> > > Hoang
>
> > > --
> > > 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]<nhusers%[email protected]>
> > .
> > > For more options, visit this group athttp://
> > 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]<nhusers%[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 
> athttp://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