我有功能
public Menu Details(int? id)
{
return _dataContext.Menu.Include("ChildMenu").FirstOrDefault(m => m.MenuId == id);
}
现在我需要添加条件到子列表ChildMenu像fieldname = id.我该怎么做?
最佳答案
return _dataContext.Menu.Include("ChildMenu")
.Where(m => m.MenuId == id && m.ChildMenu.IsDeleted == false).FirstOrDefault();