views:

136

answers:

1

I've just built an EF model over a db (Framework 3.5 sp1), and I want to create a WCF Data Service to deploy it. No problem with the entities, but now I've created a service operation like this:

[WebGet]
public IQueryable<person> PersonsGetAll()
{
    return this.CurrentDataSource.persons;
}

and I've setted in InitializeService:

config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);

So, if I try to call the operation by url, calling

http://localhost:1000/AKAdvService.AKAdvService/AKAdvDataService.svc/PersonsGetAll

it works fine, but when I add the reference to Visual Studio (2008) to this data service, I retrieve all the entities, but no operations. In the right panel of "Add Service Reference" I get the message:

"ADO.Net Data Service: No operations found."

What I'm missing?

A: 

Currently the VS's Add Service Reference does not generate methods (nor does it actually understand) for service operations. To call a service operation which returns IQueryable the recommended way is to use something like:

context.CreateQuery<person>("PersonsGetAll");

If your service operation takes parameters you can add those by calling AddQueryOption on the result of the CreateQuery.

Vitek Karas MSFT
You're right... I hope it's possible with the Framework 4.0, but by now I can't test it. Anyone know more?
tanathos
It's not in .NET 4.0 either, unfortunately.
Vitek Karas MSFT