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();