I am creating a Windows service that will act as a client for an existing site using SignalR.
I have methods IHubProxy.On<> and IHubProxy.Invoke that work when traversing specific classes.
For example, this works:
hubProxy.On<MigrationRequest>("iSWindowsServiceRequest", request => MigrateData.Invoke(request));
And the MigrationRequest looks like this:
public class MigrationRequest : IISWindowsServiceRequest { public MigrateWhat What { get; set; } public MigrationFor For { get; set; } public Guid EntityFor_Id { get; set; } }
Now, if I try this:
hubProxy.On<IISWindowsServiceRequest>("iSWindowsServiceRequest", request => Handshake.HandleRequest(request));
My request is never matched.
what I was hoping to achieve was creating single pub-sub methods, not one for each concrete class this service would accept.
Is it possible to pass an interface to On<>() methods?
The same goes for Invoke<>() - if the object I pass contains any properties that have an interface, the call never makes it.
therefore this will not work:
public class ISWindowsServiceResponse { public IISWindowsServiceRequest OriginalRequest { get; set; } public bool Success { get; set; } public string Message { get; set; } }
but it will be
public class ISWindowsServiceResponse { public MigrationRequest OriginalRequest { get; set; } public bool Success { get; set; } public string Message { get; set; } }
source share