Have you tried using the IEnumerable extensions instead? I find it much easier:
<pre lang="c#">public List<cil> Accounts( List<string> CL){
var cil= context.CIs
.Join(
context.V1,
ci=>ci.Id,
v1=>v1.Id
(ci,v1)=>new{ci, v1})
.Where(a => CL.contains(a.ci.ID))
.Select(a=>a.v1.Name)
.ToList();
}
You can then break down the query to see what's wrong.
Also, if that "context" is entity framework then the query is not run until you call ToList().
Take a look at this:
public List<cil> Accounts( List<string> CL){
var query= context.CIs
.Join(
context.V1,
ci=>ci.Id,
v1=>v1.Id
(ci,v1)=>new{ci, v1})
.Where(a => CL.contains(a.ci.ID))
.Select(a=>a.v1.Name);
var queryString = query.ToString();
return query.ToList();
}
That querystring will be the SQL that will be run on the DB (without the variables). Take a look and see if your logic is wrong somewhere. Maybe a join is wrong or the data isn't as you expect it ?
Hope that helps
Andy