Domain Service Method using Optional Parameters?

403 views Asked by At

I want to be able to bind to this datasource without the view needing to know that there is an additional parameter (unless he cares). Is this possible to do?

[Query]
public IQueryable<Product> GetProduct(int productID, bool someAdditionalStuff = false)
{
    return _someProvider.GetProduct(productID, someAdditionalStuff);
}

<DomainDataSource
   ID="ProductDataSource" 
   runat="server" 
   QueryName="GetProduct" 
   EnableDelete="false" EnableInsert="false" EnableUpdate="false">
   <QueryParameters>
      <asp:Parameter Name="ProductID" Type="Int32" DefaultValue="-1" />
   </QueryParameters>
</DomainDataSource>
1

There are 1 answers

0
David Moye On

I haven't found any way to use optional parameters in a WCF RIA domain service at all. They compile fine on the server-side code, but the generated code that makes it over to the client side contains the parameters as non-optional, as such all of the client code that wants to use the default for the optional parameter fails to compile.