Question

I am using C# to generate a Untyped Custom Data Service Provider using OData.
Implemented all the required providers and interfaces.
All the entities will be dynamically specified only during meta data creation.
EDMX or Reflection providers cannot be used.
All the access rights are provided.

1) CustomMetaDataProvider

public bool TryResolveResourceType(string name, out ResourceType resourceType)  
{  
    return this.resourceTypes.TryGetValue(name, out resourceType);  
}
public bool TryResolveServiceOperation(string name, out ServiceOperation serviceOperation)  
{
    if (serviceOperations.TryGetValue(name, out serviceOperation))
    {
        serviceOperation.SetReadOnly();
        return true;
    }
    else
    {
        serviceOperation = null;
        return false;
    }            
}

2) CustomDataQueryProvider

public object InvokeServiceOperation(ServiceOperation serviceOperation, object[] parameters)
{
//Invoke the method present in ServiceOperation
}

When I give the following url
http:// localhost/SampleService.svc/TestEntity(1)/Id>
I am able to fetch the id value.

When I call the service using the url
http:// localhost/SampleService.svc/TestServiceOperation
I am able to invoke the service operation.

But when I try to invoke the Serv.Op. after specifying an entity, i get error
http:// localhost/SampleService.svc/TestEntity/TestServiceOperation

When i use this url, It finds the corresponding TestEntityResourceSet,
then goes to finding resourcetype with name=TestServiceOperation.
But there is no resource type with TestServiceOperation. It needs to be searched in TryResolveServiceOperation with the corresponding SO name.

All the examples searched in net were like invoking the Ser.Op. after the .svc/SO type only.
I need to invoke the Service Operation separately for each entity. like

http:// localhostTest.svc/Entity1/SerOp1 http:// localhostTest.svc/Entity2/SerOp2

Any good example of how to do this? Thanks.

No correct solution

OTHER TIPS

Seems like you're looking for actions bound on EntityType. see 10.4.1. Actions in OData V3.0 Procotol for details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top