0

I am running this query on a Windows Azure Web Role, and need to get a related entity set, but my lambda expression doesn't seem to be working.

 var query = from p in applicationsContext.Programs.Expand(p => p.Campus)
                    where p.ProgramId == Int32.Parse(programsList.SelectedValue)
                    select p;

I am using System.Linq andSystem.Data.Entities already, but the lambda expression (p => p.Campus) causes the error:

Cannot convert lambda expression to type string because it is not a delegate type

Any idea as to why this wouldn't work?

EDIT: Intellisence also doesn't seem to recognize the 'p' in the lambda expression, that might be part of the problem.

2
  • Expand expects a sting, not a delegate. Maybe just "Campus" would work? Commented Dec 14, 2013 at 19:04
  • Can you share the tutorial you're working with?? Commented Dec 14, 2013 at 19:10

3 Answers 3

2

I think Expand must get string parameter (link). Then you can't use delegate instead string.

Sign up to request clarification or add additional context in comments.

3 Comments

Agree, that's the reason.
So what would be the fix? What sort of link would I be putting in?
If Campus is int, you don't need Expand this property. If Campus is related entity, then use Expand("Campus")
0

I'll hazard a guess: is p.Campus something other than string type?

1 Comment

p.Campus is an int, but judging from the example I'm working off of that shouldn't effect it
0

Not sure what data source you're going against, but do not re-use the same 'p' for the inner Expand statement:

 var query = from p in applicationsContext.Programs.Expand(t => t.Campus)
                    where p.ProgramId == Int32.Parse(programsList.SelectedValue)
                    select p;

Comments

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.