This is a migrated thread and some comments may be shown as answers.

LINQ Join result in error Field not found on class

3 Answers 72 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Timothy Fischer
Top achievements
Rank 1
Timothy Fischer asked on 06 Nov 2009, 05:38 PM
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

3 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 09 Nov 2009, 08:33 AM
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.
0
Timothy Fischer
Top achievements
Rank 1
answered on 09 Nov 2009, 02:21 PM
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
0
Zoran
Telerik team
answered on 09 Nov 2009, 04:32 PM
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.
Tags
LINQ (LINQ specific questions)
Asked by
Timothy Fischer
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Timothy Fischer
Top achievements
Rank 1
Share this question
or