Have you mapped you int_ParentId
database field to int?
type (e.g. <Column Name="int_ParentId" Type="System.Int32" DbType="Int" CanBeNull="true" />
)? If yes, both:
return _db.Categories.Where(m => m.int_ParentId == null);
and
return _db.Categories.Where(m => m.int_ParentId.HasValue);
should work.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…