I am exploring EF5 using llblgen designer, and in this case trying to put a count in the aggregate function of the Typed List in the designer.
I remember when using llblgen generated code, we had to supply the group by clause to the adapter.
So how do I go about getting the count for EF5 generated code.
I looked through the DbContext llblgen generated,
public IQueryable<NumUsersInRolesTypedListRow> GetNumUsersInRolesTypedList()
{
var current0 = this.Roles;
var current1 = from role in current0
join userFacilityRole in this.UserFacilityRoles on role.Id equals userFacilityRole.Role.Id into joinresult_1
from userFacilityRole in joinresult_1.DefaultIfEmpty()
select new {userFacilityRole, role };
return current1.Select(v=>new NumUsersInRolesTypedListRow() { Id = v.role.Id, Name = v.role.Name, NumUsers = v.userFacilityRole.UserIdFk } );
}
I had put a count aggregate function for the field UserIdFk in the designer.
I would have imagined the code would have looked something like this
var q = from r in db.Roles
join ufr in db.User_Facility_Role on r.ID equals ufr.Role_ID_FK
into rst select new { r.ID, r.Name, Num_Users = rst.Count() };
What am I missing?