I have two methods in my WCF Service:
public interface IPriceService
{
[OperationContract(Name = "GetPrice")]
decimal GetPrice(long ID);
[OperationContract(Name = "GetProductID")]
long GetProductID(string productName);
}
On a cliect side I want to do two things. I want to call a method GetProductID
and then call a method GetPrice
. So I do it like this:
PriceService.PriceServiceClient service;
service = new PriceService.PriceServiceClient();
service.PobierzPrzejsciaCompleted += service_GetPriceCompleted;
service.PobierzStacjeBenzynoweCompleted += service_GetProductIDCompleted;
service.GetProductIDAsync(productName);
service.GetPriceAsync(Id);
GetProductID
returns an ID, so I get it in GetProductIDCompleted
event. Then I pass this ID as a parameter to GetPrice
method.
What I want is: GetProductIdAsync
method should execute first. GetPriceAsync
method should wait until previous method completes.