Я использую Linq-to-sql в качестве ORM. Я написал это innerjoin
public IQueryable<Material> FindAllMaterials()
{
var materials=from m in db.Materials
join Mt in db.MeasurementTypes on m.MeasurementTypeId equals Mt.Id
select new { m.Mat_id,
m.Mat_Name,
Mt.Name,
m.Mat_Type };
return materials;
}
Но когда я скомпилировал это, я получил ошибку
Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>'
to 'System.Linq.IQueryable<CrMVC.Models.Material>'.
An explicit conversion exists (are you missing a cast?)
Я что-то упускаю ... Любое предложение ....
EDIT:
Мой sql запрос
select M.Mat_id,M.Mat_Name,T.Name as Measurement,M.Mat_Type as Description
from Material as M inner join
MeasurementTypes as T on M.MeasurementTypeId = T.Id where M.Is_Deleted=0