Reputation: 761
I'm calling WCF service asynchronously from the WP page using EAP:
ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
proxy.loginCompleted += DoLogin;
proxy.loginAsync("user", "password");
And in the Rererence.cs I see the following code that looks like APM:
public System.IAsyncResult Beginlogin(string usn, string pwd, System.AsyncCallback callback, object asyncState)
{
object[] _args = new object[2];
_args[0] = usn;
_args[1] = pwd;
System.IAsyncResult _result = base.BeginInvoke("login", _args, callback, asyncState);
return _result;
}
public bool Endlogin(System.IAsyncResult result)
{
object[] _args = new object[0];
bool _result = ((bool)(base.EndInvoke("login", _args, result)));
return _result;
}
Why do I have APM methods when I'm calling WCF service using EAP?
Upvotes: 1
Views: 143
Reputation: 149646
When you generate a Service Reference and set it to generate asynchronous operations on the client side, from .NET 3.5 and above, it will call svcutil.exe
with the /async /tcv:Version35
parameters and will generate both APM and EAP asynchronous operations.
From MSDN:
When using /tcv:Version35 with the /async switch, both event-based and callback/delegate-based asynchronous methods are generated. In addition, support for LINQ-enabled DataSets and DateTimeOffset is enabled.
Upvotes: 3