我正在使用LINQ lambda表达式,如下所示:
int Value = 1;
qryContent objContentLine;
using (Entities db = new Entities())
{
objContentLine = (from q in db.qryContents
where q.LineID == Value
orderby q.RowID descending
select q).FirstOrDefault();
}
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下错误:
无法将lambda表达式转换为类型'string',因为它不是委托类型
我在基于C#的代码中使用Entity Framework.我遇到了意想不到的怪异,正在寻找建议.
案例1,2,3,4 ......项目:
RivWorks.dll
RivWorks.Service.dll
RivWorks.Alpha.dll
样本(所有这些工作):
RivWorks.Alpha.dll:
public static bool EndNegotitation(long ProductID)
{
var product = (from a in _dbFeed.AutoWithImage
where a.AutoID == ProductID select a).FirstOrDefault();
...
}
Run Code Online (Sandbox Code Playgroud)
RivWorks.Service.dll
public static RivWorks.Model.NegotiationAutos.AutoWithImage
GetProductById(long productId)
{
var myProduct = from a in _dbFeed.AutoWithImage
where a.AutoID == productId select a;
return myProduct.FirstOrDefault();
}
public static List<RivWorks.Model.NegotiationAutos.AutoWithImage>
GetProductByCompany(Guid companyId)
{
var myProduct = from a in _dbFeed.AutoWithImage
where a.CompanyID == companyId select a;
return myProduct.ToList();
}
Run Code Online (Sandbox Code Playgroud)
等等
案例"怪异":
RivWorks.Web.Service.dll(WCF项目)
包含与其他项目相同的引用.
public …Run Code Online (Sandbox Code Playgroud)