locked
Ado.net data service in the creation of a function reference and return to the issue of RRS feed

  • Question

  • Ado.net data service in the creation of a Function, and stored procedure is mapped to an entity, will return to an associated entity, how to invoke the client and get back to the Function entity

    --SSDL
    <Function Name="CheckAKing" Aggregate="false" BuiltIn="false"....>
    <parameter ..../>
    </Function>

    --CSDL
    <FunctionImport Name="CheckAKing" EntitySet="Index" ReturnType="Collection(Icmdb_en_US.Index)">
                <Parameter Name="Entity" Mode="In" Type="String" />
                ......
    </FunctionImport>

    --C-S
    <FunctionImportMapping FunctionImportName="CheckAKing" FunctionName="Icmdb_en_US.Store.CheckAKing" />
    Friday, April 24, 2009 6:51 AM

Answers

  • Hi Martin,

    Just to make sure, are you having trouble exposing a function import in your entity-framework model as a service operation?

    You can see an example of how to do so here:
    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/4ae8ab21-61ea-4947-8535-f6640a51da21/

    Once you've set up the service operation, you should be able to access it from the client using the code Jimmy provides above, assuming that the service operation is named 'CheckAKing' and takes a single string parameter called 'Entity' as it does in your model. Note that the service operation need not match the model exactly.
    Matt Meehan, ADO.NET Data Services (Astoria)
    Tuesday, May 26, 2009 5:15 AM
    Moderator

All replies

  • Hi Martin,

    Are you trying to invoke the service operation and get the results using the client?  You can use DataServiceContext.Execute<T>(), for example:

        DataServiceContext ctx = new DataServiceContext(serviceRoot);
        IEnumerable< Icmdb_en_US.Index> result = ctx.Execute<Icmdb_en_US.Index>(new Uri("http://server/service.svc/CheckAKing?Entity='value'"));

    Hope this helps.

    -J

    Tuesday, May 26, 2009 3:49 AM
    Answerer
  • Hi Martin,

    Just to make sure, are you having trouble exposing a function import in your entity-framework model as a service operation?

    You can see an example of how to do so here:
    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/4ae8ab21-61ea-4947-8535-f6640a51da21/

    Once you've set up the service operation, you should be able to access it from the client using the code Jimmy provides above, assuming that the service operation is named 'CheckAKing' and takes a single string parameter called 'Entity' as it does in your model. Note that the service operation need not match the model exactly.
    Matt Meehan, ADO.NET Data Services (Astoria)
    Tuesday, May 26, 2009 5:15 AM
    Moderator