This question is locked. New answers and comments are not allowed.
I am trying to bind a collection of a persistent class via the OpenAccessDataSource to a RadGrid. However, i am getting this exception: "Projecting collection fields not supported yet."
Checking the forums, I've seen that someone inquired earlier this year about the feature & that it's not supported yet. It's close to a year since that posting and I'm very surprised this has not been implemented yet. This is a feature I am looking to use, and is there any expected time frame for getting this feature implemented? Or is there any suggested workaround with the OpenAccessDataSource?
Checking the forums, I've seen that someone inquired earlier this year about the feature & that it's not supported yet. It's close to a year since that posting and I'm very surprised this has not been implemented yet. This is a feature I am looking to use, and is there any expected time frame for getting this feature implemented? Or is there any suggested workaround with the OpenAccessDataSource?
4 Answers, 1 is accepted
0
Hello Schmidty,
Could you please elaborate a bit more on what you are trying to achieve? Providing some code would be helpful as well. The OpenAccessDataSource is bound to a single persistent type and cannot be used with projections.
Sincerely yours,
Alexander
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.
Could you please elaborate a bit more on what you are trying to achieve? Providing some code would be helpful as well. The OpenAccessDataSource is bound to a single persistent type and cannot be used with projections.
Sincerely yours,
Alexander
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
Schmidty
Top achievements
Rank 2
answered on 16 Dec 2009, 08:16 AM
I am trying to bind a single persistent type that is mapped via collection field (m:m). Here is my example:
Artist class
Exhibition class
I have a map table (ArtistExhibitionMap) to reflect the m:m relationship, and in my persistent classes each has collection of each type. This map table is not a persistent type.
Now I want to get all the exhibitions for that particular artist bound to a grid using the OpenAccessDataSource. I can do this fine with persistent types with a 1:m relationship, but am not sure how to accomplish this with collection fields. I would like the ability of querying for one persistent type (Exhibition) using the Artist's id.
Does this help explain what my intentions are?
Thanks,
Mark
Artist class
Exhibition class
I have a map table (ArtistExhibitionMap) to reflect the m:m relationship, and in my persistent classes each has collection of each type. This map table is not a persistent type.
Now I want to get all the exhibitions for that particular artist bound to a grid using the OpenAccessDataSource. I can do this fine with persistent types with a 1:m relationship, but am not sure how to accomplish this with collection fields. I would like the ability of querying for one persistent type (Exhibition) using the Artist's id.
Does this help explain what my intentions are?
Thanks,
Mark
0
Accepted
Hi Schmidty,
Thank you for the explanation. In fact this is possible by using the Exists OQL keyword in the where clause. The condition should be set to the Where property of the datasource. In your case the configuration would look similar to this:
The Where condition expects a parameter named artistId which is automatically obtained from a RadComboBox. The combobox itself uses another datasource to display the Artist objects. Depending on your application the parameter can be obtained from the session or the query string as well .
Hope that helps.
Sincerely yours,
Alexander
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.
Thank you for the explanation. In fact this is possible by using the Exists OQL keyword in the where clause. The condition should be set to the Where property of the datasource. In your case the configuration would look similar to this:
<
telerik:OpenAccessDataSource
ID
=
"OpenAccessDataSource1"
runat
=
"server"
ObjectContextProvider
=
"MyNamespace.ObjectScopeProvider1, MyProjectName"
TypeName
=
"MyNamespace.Exhibition"
Where
=
"EXISTS a IN this.Artists : (a.ArtistID = @artistId)"
>
<
WhereParameters
>
<
asp:ControlParameter
ControlID
=
"RadComboBox1"
Name
=
"artistId"
PropertyName
=
"SelectedValue"
/>
</
WhereParameters
>
</
telerik:OpenAccessDataSource
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
Runat
=
"server"
DataSourceID
=
"OpenAccessDataSource2"
DataTextField
=
"FirstName"
DataValueField
=
"ArtistID"
AutoPostBack
=
"True"
>
</
telerik:RadComboBox
>
<
telerik:OpenAccessDataSource
ID
=
"OpenAccessDataSource2"
runat
=
"server"
ObjectContextProvider
=
"MyNamespace.ObjectScopeProvider1, MyProjectName"
TypeName
=
"MyNamespace.Artist"
>
</
telerik:OpenAccessDataSource
>
Hope that helps.
Sincerely yours,
Alexander
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
Schmidty
Top achievements
Rank 2
answered on 20 Dec 2009, 08:49 PM
Thanks Alexander. This worked out great for me.