I am using Linq2SQL and working with a legacy system. The system was built in .Net but without a datalayer so I am transcoding it so that it will have one. I have a linq query that looks like this...
var data = from p in db.tblPeoples
orderby p.strLastName,p.strFirstName
select new
{
guidPersonId = p.guidPersonId,
strFirstName = p.strFirstName,
strLastName = p.strLastName,
strRank = p.tblCodesRank.strDescription,
strPhone = p.strPhone,
strEmail = p.strEmail,
strOffice = p.tblOrganization.strAcronym,
RolesList = p.tblRoles
};
and when I check the signature of the var it is an IQueryable and I have no idea what that is. In my datalayer I have this returning as an IQueryable, but when I try to use the datalayer version and then do a .where on the returned dataset to search on it, I get errors that I Cannot convert lambda expresstion to type 'string' because it is not a delegate type.
What should I do about this? I am trying to create code reuse and use my datalayer version that is already written. the data layer version looks like this:
public static IQueryable RetrieveAllPeople()
{
var data = from p in db.tblPeoples
orderby p.strLastName, p.strFirstName
select new
{
guidPersonId = p.guidPersonId,
strFirstName = p.strFirstName,
strLastName = p.strLastName,
strRank = p.tblCodesRank.strDescription,
strPhone = p.strPhone,
strEmail = p.strEmail,
strOffice = p.tblOrganization.strAcronym,
RolesList = p.tblRoles
};
return data;
}