Get all columns by eager loading

by seyyed hamid shojaedin   Last Updated September 22, 2019 09:26 AM - source

I created a table with relation with ApplicationUser and when I want to get with eager-loading, I could not get all columns from that table my search base on user authentication.

var UserSites = await _SqldbContext.Users
                                   .Where(x => x.UserName == User.Identity.Name)
                                   .Include(x => x.sites)
                                   .ToListAsync() ;
return Json(UserSites);

But in return I only get one row of that table with two columns

[{"sites":[{"id":1,"userId":"c0e8be95-535c-449c-9aa1-06702cd4c983"

but I have more rows with this userId and also here I get only two columns but I have more than two columns, I am not sure what is wrong here please help me.



Related Questions