use*_*348 0 .net c# linq exception
我有这个代码:
public article GetArticleByWebSite(string webSite)
{
using (var context = new ceopolandEntities())
{
return context.article.Where(a => a.WebSite == webSite).First();
}
}
Run Code Online (Sandbox Code Playgroud)
在打电话之前检查文章是否为空的最佳方法是First()什么?
尝试捕获块或引入变量并检查有多少文章?
| 归档时间: |
|
| 查看次数: |
44 次 |
| 最近记录: |