1

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.

1 Answer 1

1

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")
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Aducci! Now thatI am headed in the right direction how would I grab all columns where "Available" is null? I have tried the following but in only brings back the rows where Available = "weekends" I want to also bring back the rows if Available is Null: Where (m.MediatorRestrictionsAvailabilities.Any(Function(a) a.Availability = String.Empty Or a.Availability.Contains("weekends") = True)) _
@Asmussen - I am not too sure what you are asking. It would be best if you ask a new question.
Aducci, I posted a seperate post here: stackoverflow.com/questions/7017889/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.