what i'm trying to do it's simple search by three columns: firstname, lastname and email
in my case i need that two f开发者_Python百科irst colums (firstname and lastname) will be searchable by like operator and the last one (email) by equal operator
but im getting error that does not explain what should i do:
in plain sql it should be something like this:
Select *
From Member
Where FirstName like '%value%' Or LastName like '%value%' Or Email='value'
but what im doing wrong?
You can try with
.Where(Restrictions.Disjunction()
.Add(Restrictions.On(x => x.FirstName).IsLike(keyWord))
.Add(Restrictions.On(x => x.LastName).IsLike(keyWord))
.Add(Restrictions.On(x => x.FirstName).IsLike(keyWord))
.Add(Restrictions.Eq(x.Email,keyWord))
)
I hope it's helpful
精彩评论