"Projecting collection fields not supported yet.

Thread is closed for posting
5 posts, 1 answers
  1. Schmidty
    Schmidty avatar
    22 posts
    Member since:
    Jan 2007

    Posted 14 Dec 2009 Link to this post

    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?
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 16 Dec 2009 Link to this post

    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.
  3. Schmidty
    Schmidty avatar
    22 posts
    Member since:
    Jan 2007

    Posted 16 Dec 2009 Link to this post

    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
  4. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 17 Dec 2009 Link to this post

    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.
  5. Schmidty
    Schmidty avatar
    22 posts
    Member since:
    Jan 2007

    Posted 20 Dec 2009 Link to this post

    Thanks Alexander. This worked out great for me.
Back to Top