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

Projecting collection fields not supported yet

1 Answer 83 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.
Liam
Top achievements
Rank 1
Liam asked on 23 Feb 2009, 04:49 PM
I'm getting the above error in my project when I run the following LINQ query.

var result = from c in scope.Extent<Company>()  
                         select c.CompanyContacts; 

Within the generated Company class I have CompanyContacts declared, so I don't think this is the problem.

In http://www.telerik.com/community/forums/orm/linq-questions/collection-fields.aspx I see the same error has occured and the issue was resolved in a later build of OpenAccess. The version of OpenAccess I'm using was downloaded in January, so this should have the fix included in it.

As always, any help would be greatly appreciated.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 24 Feb 2009, 08:44 AM
Hello Liam,

in your case the CompanyContacts is a collection field, and projections of a collection field is not supported yet. The other case you mentioned is about projections of scalar values. The only logical result set in your case would be a list of lists; I'm not sure that's what you want. The quickest way to access the collection content is to do a 'from c in scope.Extent<Company>() select c' and use a proper fetch plan in order to have the generated query join in the needed CompanyContact instances.

Best wishes,
Thomas
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
LINQ (LINQ specific questions)
Asked by
Liam
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Share this question
or