Reputation: 53
I have two projects inside my solution, Core and Infrastructure. In Core I have my Services and in Infrastructure I have SignalR. I somehow need to access my Services from SignalR and SignalR from Services.
For second case to be clearer: I'm using Stripe, and listening for Stripe Webhooks (inside services) and sending update to client about their order while they are on order page.
How can I make this without causing circular dependency?
Thanks
Upvotes: 1
Views: 900
Reputation: 1613
The most common way to do this is to add an extra abstraction layer, and have the classes use the interfaces for each service.
Now, for the SignalR part of your question, the first thing I think of is define an Event
on your service and subscribe to it on the Hub.
This way you decouple the Service from the Hub, as the Service does not need to know about the Hub, and will just fire the event.
Upvotes: 1