Not Finding Method With Parameters in DomainContext

8 posts, 0 answers
  1. ANDY
    ANDY avatar
    2 posts
    Member since:
    Oct 2010

    Posted 21 Feb 2011 Link to this post

     

     

     

     

     

    I have a method in the doamin service that expects a Parameter.

    The RadDomainDatasource does not find it and throws an expection.

    "Could not find a matching query method on the DomainContext."

    I set the Parameter in the code before loading the data.

    The generic Ria DomainDataSource work with the same service and method.

    Help anyone?

    Thanks in advance.

     

     

     

     

     

    <riaControls:DomainDataSource AutoLoad="False" d:DesignData="{d:DesignInstance ds:EMSalesDomainContext, CreateList=true}" Height="0" Name="ProductsDataSource" QueryName="GetProductGroupsForCustomerQuery" >

     

     

     

     

     

    <riaControls:DomainDataSource.DomainContext>

     

     

     

     

     

    <ds:EMSalesDomainContext/>

     

     

     

     

     

    </riaControls:DomainDataSource.DomainContext>

     

     

     

     

     

    </riaControls:DomainDataSource>

     

     

     

     

     

     

     

     

     

     

     

    <telerik:RadDomainDataSource x:Name="ProductsDataSource2"

     

     

     

     

    AutoLoad="False" QueryName="GetProductGroupsForCustomerQuery" > (This is not found)

     

     

     

     

     

    <telerik:RadDomainDataSource.DomainContext>

     

     

     

     

     

    <ds:EMSalesDomainContext />

     

     

     

     

     

    </telerik:RadDomainDataSource.DomainContext>

     

     

     

     

     

    </telerik:RadDomainDataSource>

     

     

     

     

     

     

     

     

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 21 Feb 2011 Link to this post

    Hello ANDY,

    That is very weird. Could you please open a separate support ticket and attach a sample project the demonstrates this. We will examine it immediately to see what is wrong.

    Thanks in advance. We are looking forward to hearing from you.

    Regards,
    Ross
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. DevCraft banner
  4. ANDY
    ANDY avatar
    2 posts
    Member since:
    Oct 2010

    Posted 24 Feb 2011 Link to this post

    Resolved by Telerick support, might help someone else.
     

    You need to define the parameter in XAML and later you can change its Value. This is because the query method:

    public EntityQuery<CustomerProductGroup> GetProductGroupsForCustomerQuery(int CustomerId)

    ... is searched using reflection and we need the parameter in order to locate the exact method.

    So you should do this in XAML:

    <telerik:RadDomainDataSourcex:Name="ProductsDataSource2"

                                 AutoLoad="False"

                                 QueryName="GetProductGroupsForCustomerQuery"                              >

        <telerik:RadDomainDataSource.QueryParameters>

            <telerik:QueryParameterParameterName="CustomerId"/>

        </telerik:RadDomainDataSource.QueryParameters>

        <telerik:RadDomainDataSource.DomainContext>

            <ds:EMSalesDomainContext/>

        </telerik:RadDomainDataSource.DomainContext>

    </telerik:RadDomainDataSource>

    And then in code-behind you only need to do this:

    privatevoidbtnGetDataClicked(objectsender, RoutedEventArgs e)

    {

        ProductsDataSource2.QueryParameters.Single(p => p.ParameterName == "CustomerId").Value = 4;

        ProductsDataSource2.Load();

    }


    Don't Clear the parameters.

  5. richard
    richard avatar
    48 posts
    Member since:
    Dec 2010

    Posted 22 Mar 2011 Link to this post

    the .Single is not an option when I try that method.

    Richard
  6. Ondrej
    Ondrej avatar
    2 posts
    Member since:
    Oct 2010

    Posted 14 Apr 2011 Link to this post

    Did you Solve this problem some how?, I have same problem. I have RadDomainDataSource only in CodeBehind

    Thank you
  7. richard
    richard avatar
    48 posts
    Member since:
    Dec 2010

    Posted 15 Apr 2011 Link to this post

    I decided to use a load operation on a domain context instead of fighting the .Single problem
  8. Josef Rogovsky
    Josef Rogovsky avatar
    144 posts
    Member since:
    Sep 2012

    Posted 14 Jul 2011 Link to this post

    Thanks,

    I've seen this error from time to time but didn't realize it was because of the parameter.

    Now I know the answer.
  9. P
    P avatar
    3 posts
    Member since:
    Jan 2012

    Posted 31 Jan 2012 Link to this post

    Hi,

    Useful technique I found if you want to reuse a raddomaindatasource but with different queryname/parameters.

    Set the queryname to null (preventing it from using reflection to scan the query methods on the domaincontext), add remove parameters etc, then set the queryname to query method you need.

    cheers
    pb
Back to Top
DevCraft banner