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

Where clause failing in INNER join LINQ

4 Answers 90 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.
FISCAL
Top achievements
Rank 1
FISCAL asked on 24 May 2010, 10:36 AM
Hi,

When I add 'where' clause in the inner join linq query, it is throwing runtime- error.

Got to resolve many to many scenario -
1. User table
2. Organisation table
3. UserOrganisation table

LINQ query..


  IEnumerable<UserForGridDisplay> userList = from user in m_scope.Extent<User>()
                                             join userOrg in m_scope.Extent<UserOrganisation>() on user.UserID equals userOrg.UserID
                                             join org in m_scope.Extent<Organisation>() on userOrg.OrganisationID equals org.OrganisationID
                                            where org.OrganisationID == orgID //Problem here
                                             select new UserForGridDisplay
                                                {
                                                Forename            = user.UserForename,
                                                OrganisationName    = org.OrganisationName
                                                };



Identifier '<>h__TransparentIdentifier4' is not a parameter or variable or field of 'ORM_ClassLibrary.User'. If '<>h__TransparentIdentifier4' is a property please add the FieldAlias or Storage attribute to it or declare it as a field's alias. 
Error..


Any help if highly appreciated.

Many thanks.

M G

4 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 25 May 2010, 11:39 AM
Hi M G,

it looks like an issue that is fixed in the upcoming version as I cannot reproduce it.
To work around it I would rewrite the query a bit like

IEnumerable<UserForGridDisplay> userList =  from org in m_scope.Extent<Organisation>()
       where org.OrganisationID == orgID
join userOrg in m_scope.Extent<UserOrganisation>()
       on org.OrganizationID equals userOrg.OrganizationID
join user in m_scope.Extent<User>()
      on userOrg.UserID equals user.UserID
                                             select new UserForGridDisplay
                                                {
                                                Forename            = user.UserForename,
                                                OrganisationName    = org.OrganisationName
                                                };
 

All the best,
Thomas
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
FISCAL
Top achievements
Rank 1
answered on 25 May 2010, 11:43 AM
Hi Thomas,

Thank you very much for your reply. I amnot sure which version you are refering to when you say "upcomin version". I tried in the last internal build as well :(

Please let me know when we will get the lastest version with this problem fixed and many other features like supporting SQL  Default values in Reverse mapping process.

Many thanks.

Cheers,
M G
0
Thomas
Telerik team
answered on 25 May 2010, 02:21 PM
Hello M G,

we are in the phase of preparing a new build. I expect 2 additional days for this.

All the best,

Thomas
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
kunal
Top achievements
Rank 1
answered on 10 Sep 2010, 10:41 AM
hey

Can u please explain me what is IEnumerable<UserForGridDisplay>...
what is "UserForGridDisplay"????????

waiting for replay!!!!!!!!!!!!!!
Tags
LINQ (LINQ specific questions)
Asked by
FISCAL
Top achievements
Rank 1
Answers by
Thomas
Telerik team
FISCAL
Top achievements
Rank 1
kunal
Top achievements
Rank 1
Share this question
or