我想要使用以下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