Hi all. I just started to learn how to use WCF. I encouter the compiling errors when tring to use System.Action to call the WCF service. Here is the code that calls the generic function:
In UserServiceProxy.cs:
new ClientFactory().TryExecuteAndClose(delegate(UserServiceClient client)
{
UserEntity entity=client.GetCurrentUser(true)
},uncompressed);
Then in ClientFactoryBase.cs, I have:
public void TryExecuteAndClose
{
var client=default(UserServiceClient);
if(typeof(Client).Name=="UserServiceClient")
{
if(bindingType.Equals("uncompressed"))
client=new UserServiceClient("basic");
else
client = new UserServiceClient("secure");
}
action(client); //##############this is where I got compile error.
client.Close();
}
The 2 errors that I got are complaining about "delegate System.Action
Could someone help me on how to fix the errors? Thanks a lot.
VulpesPosted May 6, 2011, 3:59 PM
action(client);
with:
action((Client)(object)client);
MiaoMiao MPosted May 10, 2011, 11:10 AM
VulpesPosted May 9, 2011, 6:41 PM
MiaoMiao MPosted May 9, 2011, 12:27 PM
MiaoMiao MPosted May 6, 2011, 5:38 PM