I want to have following type of query in entity frame work
SELECT c2.* FROM Category c1 INNER JOIN Category c2 ON c1.CategoryID = c2.ParentCategoryID WHERE c1.ParentCategoryID is NULL
How to do the above work in Entity framework...
Well, I don't know much about EF, but that looks something like:
var query = from c1 in db.Category where c1.ParentCategoryId == null join c2 in db.Category on c1.CategoryId equals c2.ParentCategoryId select c2;
Just to tidy this up the following is a bit nicer and does the same thing:
var query = from c1 in db.Category from c2 in db.Category where c1.ParentCategoryId == null where c1.CategoryId == c2.ParentCategoryId select c2;