none
Disorintate NumStatus1 after group RRS feed

  • Question

  • hello, Disorintate NumStatus1 after group

    var query1 = from l in db.Lessons
                             join f in db.Faculties
                             on l.IdFaculty equals f.IdFaculty
                             where f.NumStatus1 > 0
                             join t in db.TimeTables
                             on l.IdLesson equals t.IdLesson
                             where (t.IdLesson == null && l.Offer == true)
                             group l by l.IdFaculty into g
                             orderby (g.Select(l => l.IdLesson).Distinct().Count() / g.Select(l => l.NumStatus1)) => error
                             select new { g.Key};

    Error :  does not contain a definition for 'NumStatus1' and no extension method 'NumStatus1' accepting a first argument

    Saturday, September 6, 2014 8:31 PM

Answers

  • Hello atarpan,

    From your provided linq query, it seems that the “NumStatus1” belongs to Faculties entity, while you only groupby the Lessons entity as “group l by l.IdFaculty into g” so that the “g” only contains properties of Lessons, trying to include the Faculties entity as well:

    group new { l,f } by l.IdFaculty into g

    And access the NumStatus1 property as “g.Select(l => l.f.NumStatus1)).Count()”

    Please note that the "g.Select(l => l.f.NumStatus1))" would just return a collection type which could not do a "/" operation.

    Best Regards,

    Fred.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 8, 2014 6:35 AM
    Moderator