Entity Framework linq query
I need help formatting my link query properly, I am using EF 3.5:
Dim mediators = (From m In entity.Mediators _
Where m.MediatorAvailabilities.Available = "Weekends"
Where (m.isActive = True) _
Order By m.Sequence _
Select New RankingCriteria() With { _
.FirstName = m.FirstName, _
.LastName = m.LastName, _
.CompanyName = m.CompanyName, _
开发者_运维知识库 .PhoneHome = m.PhoneHome, _
.PhoneWork = m.PhoneWork, _
.PhoneMobile = m.PhoneMobile, _
.Email = m.Email _
}).ToList()
I have a navigation property in Mediators to MediatorAvailabilities I want to do something like what is in where clause above in order to filter my results. It's not letting me navigate to the appropriate column by doing this: m.MediatorAvailabilities.Available.
How do I do this filter properly?
Thanks, Justin.
You will need to use the Any
method. I dont know the proper VB syntax, but it should look something like this:
Where m.MediatorAvailabilities.Any(ma => ma.Available = "Weekends")
精彩评论