Last post Dec 04, 2013 04:14 AM by subalakshmi.ms
May 21, 2013 11:40 AM|CodeAnalyzer|LINK
i am trying to compare a Sessions list with another list after splitting with comma in where command and unable to do that, here is the query.
public static List<CorporatesInvoice> SelectInvoicesForCorporates(int CorporateID, int CenterID, List<int> SessionID, LanguageEnum languageParam)
ELSPortalDataContext db = new ELSPortalDataContext();
var obj = (from r in db.SessionClassStudents
join j in db.CorporateInvoices.ToList().Where(o => o.ObjectID.Split(',').ToList().All(c => SessionID.Contains(Convert.ToInt32(c)))) on CorporateID equals j.CorporateID
select new CorporatesInvoice
lets say List of SessionID is [47,48,49] and string ObjectID in db is like 48,49. if SessionID is matching completely with object ID only then that record should return i.e if List of Session ID have 45,44 and ObjectID in db also have the
same 45,44 -> this could be in reverse order
kindly take a look especially at highlited code and let me know what is wrong and how to make it working? it says "Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator"
Dec 04, 2013 04:14 AM|subalakshmi.ms|LINK
In contains clause, use SessionId.Split(',').