How to pass parameters from client to method in server in order to get entity data.
At Server side :
List<Foo> getFoos = _serverObject.GetFoos(p1, p2); //Here's how I am getting foo from another server
class FooProvider
{
public IQueryable<Foo> Foos
{
get{return getFoos.AsQueryable();}
}
}
At Client Side :
var res = from f in ctx.Foos
where f.p1 == p1_val && f.p2 == p2_val
select f;
Now what I am trying to get is all Foo record depend on p1_val
and p2_val
parameters, but I would have to pass it to _serverObject.GetFoos(p1, p2)
; so that the p1
and p2
are set from client not from the server.
Please suggest some mechanism
I do believe what you try to achieve is mostly related to
Using an ADO.NET Entity Framework DataSource(WCF Data Services)
and passing a parameter from client to server is only the tip of the iceberg however if I am wrong and all your problems will be resolved by only passing complex types p1, and p2 from client to server then do the following:
Moral of the story: You need to define those two types in your service as Data Contracts so you can use them as parameter in your proxy class on the client side.