I am trying to convert this sql into Linq query but I am getting no success. Could you help with the same.
SELECT G.Id,G.UserGroupName, G.Status, G.IsDeleted ,(SELECT COUNT(*) FROM UserGroupMapping U WHERE U.UserGroupId=G.Id) [UserCount]
,(SELECT COUNT(*) FROM UserGroupRoleMapping R WHERE R.UserGroupId=G.Id) [RolesCount]
FROM UserGroup G
UserGroupandUserGroupRoleMapping, right? Could you show your entities and what have you tried so far?Count()of theRolesandGroupsrelations. If you just want to display a report though, SQL is the simplest and fastest choice