LINQ Join result in error Field not found on class

4 posts, 0 answers
  1. Timothy Fischer
    Timothy Fischer avatar
    10 posts
    Member since:
    Mar 2009

    Posted 06 Nov 2009 Link to this post

    The following linq statement:

                var myPc = (
                              from pc in Scope.Extent<VwPhaseContact>()
                              join c in Scope.Extent<Contact>() on pc.ContactID equals c.ContactID
                              where pc.PhaseID == phaseId
                              orderby pc.ContactTypeID
                              select new
                                         {
                                             Pcid = pc.Pcid,
                                             ContactId = c.ContactID,
                                             ContactName = c.LastName + ", " + c.FirstName,
                                             ContactTypeDesc = pc.TypeDesc,
                                             Email = c.Email,
                                             ContactType = pc.ContactType,
                                         }
                          );




    Results in the following error:
        Field 'pc' not found on class 'WisBuild_Model.VwPhaseContact'.

    We are running the latest version of Telerik ORM updated Q3 Release.

    Any help would be appreciated
  2. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 09 Nov 2009 Link to this post

    Hello Timothy Fischer,

    This appeared to be an issue in our Expression Tree processing. There is an easy workaround though, you just have to switch the places of the where and orderby clauses. Your query should have the following look:

    var myPc = (
                              from pc in Scope.Extent<VwPhaseContact>()
                              join c in Scope.Extent<Contact>() on pc.ContactID equals c.ContactID
                              orderby pc.ContactTypeID
                              where pc.PhaseID == phaseId
                              select new
                                         {
                                             Pcid = pc.Pcid,
                                             ContactId = c.ContactID,
                                             ContactName = c.LastName + ", " + c.FirstName,
                                             ContactTypeDesc = pc.TypeDesc,
                                             Email = c.Email,
                                             ContactType = pc.ContactType,
                                         }
                          );

    Kind regards,
    Zoran
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Timothy Fischer
    Timothy Fischer avatar
    10 posts
    Member since:
    Mar 2009

    Posted 09 Nov 2009 Link to this post

    Zoran,

    Great!  Workaround is easy, but when might the actual fix go into prod?  With a large codebase, I don't necessarily like workarounds that require refactoring later, but will implement this now.

    Thanks,

    Tim
  5. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 09 Nov 2009 Link to this post

    Hi Timothy Fischer,

    This fix should be part of the product as early as the next service pack/internal build from OpenAccess. Should not take too long. Thanks for your patience.

    Sincerely yours,
    Zoran
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top