【发布时间】:2015-05-24 21:38:45
【问题描述】:
我一直在努力尝试使用 EntityFramework LINQ 查询进行第一次 JOIN。当我在没有连接的情况下创建此查询时,我没有收到错误消息。我需要做什么?
public List<PLANT> getPlantDetails(int plantid)
{
List<PLANT> plantDetails = (from plant in db.PLANTs
join bloom in db.BLOOMs on plant.PLANT_ID equals bloom.PLANT_ID
where plant.PLANT_ID == bloom.PLANT_ID
&& plant.PLANT_ID == plantid
select new
{
plant.PLANT_ID,
plant.PL_GENUS,
plant.PL_SPECIES,
plant.PL_NAME,
plant.PL_DESC,
plant.PL_HEIGHT,
plant.PL_SPACING,
plant.PL_IMAGE,
plant.PL_IMAGE_THUMB,
bloom.BLOOM_DESC
}).ToList();
return plantDetails;
}
【问题讨论】:
标签: c# entity-framework join linq-to-entities