I've got this class:
class UrlManagementServiceClient : System.ServiceModel.ClientBase<IUrlManagementService>, IUrlManagementService
ClientBase implements IDisposable
and ICommunicationObject
. I've also got this interface:
interface IUrlManagementProxy : IUrlManagementService, ICommunicationObject, IDisposable
But I can't cast UrlManagementServiceClient
objects to IUrlManagementProxy
. Is there some way to accomplish this? I want to end up with an object that can access all the methods on all three interfaces.
You can only cast to interfaces that you inherit from, to be able to cast to IUrlManagementProxy
you need to implement that interface.
class UrlManagementServiceClient :
System.ServiceModel.ClientBase<IUrlManagementService>, IUrlManagementProxy
You can then cast UrlManagementServiceClient
to either UrlManagementProxy
, IUrlManagementService
, ICommunicationObject
or IDisposable
.
Edit
The WCF-generated classes are partial, that means that you can extend the class definition in another file. Put
public partial class UrlManagementServiceClient : IUrlManagementProxy {}
in another code file and your class will implement your full IUrlManagementProxy
interface too and you can then cast it to IUrlManagementProxy
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With