开发者

Entity Framework linq query

开发者 https://www.devze.com 2023-03-27 01:15 出处:网络
I need help formatting my link query properly, I am using EF 3.5: Dim mediators = (From m In entity.Mediators _

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")
0

精彩评论

暂无评论...
验证码 换一张
取 消