我想要使用以下LINQ到SQL查询来获得结果。但它并不适用于如果parentCategoryId为空如何检查LINQ到SQL空值
public static IEnumerable<Category> GetChildren(this Table<Category> source, int? parentCategoryId)
{
var categories = from c in source where c.ParenCategoryId == parentCategoryId select c;
return categories;
}
通过,但下面的作品,如果空直接用于地方parentCategoryId
的public static IEnumerable<Category> GetChildren(this Table<Category> source, int? parentCategoryId)
{
var categories = from c in source where c.ParenCategoryId == null select c;
return categories;
}
检查(ParenCategoryID isEqualTo:NULL),那么你想要做什么。 – vishiphone