Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am moving a project from working with standard DB queries to working with EF and LINQ. I have a table that has certain records that I would use to build a query that would look like the following:
SQL
select * from client where city = ...
In my original table, I would be pulling client and city from the table to build that query.
It is also possible that client and city above could be another table and/or field altogether. How would I do the same thing with EF and LINQ? Is this even possible or do I have to build a separate class to handle all of that logic?
SQL
from c in context.clients
 where c.city == ....
 select c
Posted
Updated 27-Jul-11 19:25pm
v2

1 solution

Are you asking about having multiple data sources to a LINQ query?

Something like this? I am using LINQ to Objects but the idea is the same.

C#
//Find the numbers in numbers that are also in values
int[] numbers = new int[] { 2, 4, 6, 7, 8, 9 };
int[] values = new int[] { 2, 3 };

var rez = from n in numbers
          from v in values
          where n == v
          select n;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900