beginner to linq to entity sql: How do I write this linq to Entity query

@Parameter = (some_value)
select * from C1
where C1.number = 
(select number from C2
where id = @Parameter)

pointers to good resources for learn the concepts of linq to entities will also be helpful. Thanks

Answers


You can use the following format:

var p = parameter;

from c in C1
where C.number == ( from x in C2
                   where x.id == p
                   select x).FirstOrDefault()
select c;

Here is the official MSDN documentation with examples for Linq To Entities.


Need Your Help

Trouble with check boxes using get and javascript/jquery

javascript jquery forms checkbox

I am working on the following form for a local charity.

Can a Java Spring application take advantage of swagger

java spring spring-mvc swagger

I've been looking into swagger as a possible way to automatically generate documentation for my team's api http://swagger.io/getting-started/. It seems very promising, but I find their documentation