Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
用于从 ParentCategoryID 列中选择 NULL 值的以下 SQL 查询的 LINQ 是什么:
SELECT ID, CategoryName, ParentCategoryID FROM Category WHERE (ParentCategoryID IS NULL)
我尝试遵循 LINQ 但不起作用:
from u in db.Categories where (u.ParentCategoryID == null) select u
制作一些包含字段的类,您选择的那些(Class1)
List<Class1> list = CategoryRepository.Categories .Where(x => x.ParentCategoryId != null) .Select(x => new Class1(x.CategoryName, x.ParentCategoryId) .ToList();