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

"Projecting collection fields not supported yet.

4 Answers 66 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Schmidty
Top achievements
Rank 2
Schmidty asked on 14 Dec 2009, 08:25 PM
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?

4 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 16 Dec 2009, 07:57 AM
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.
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
0
Accepted
Alexander
Telerik team
answered on 17 Dec 2009, 10:05 AM
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:
<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>
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.
0
Schmidty
Top achievements
Rank 2
answered on 20 Dec 2009, 08:49 PM
Thanks Alexander. This worked out great for me.
Tags
General Discussions
Asked by
Schmidty
Top achievements
Rank 2
Answers by
Alexander
Telerik team
Schmidty
Top achievements
Rank 2
Share this question
or