Sto cercando di usare la seguente query da linq a sql per ottenere il risultato. Ma non è così, se le opere parentCategoryId passato come nullacome controllare il valore nullo in linq a 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;
}
ma seguenti opere se nulla utilizzate direttamente al posto di 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;
}
se (ParenCategoryID isEqualTo: NULL) poi fare quello che vuoi. – vishiphone