C
C#2y ago
Hugh

✅ Using Dependency Injection, sharing singletons between builders?

I'm not sure if I'm taking a completely off-the-wall approach to this, so please let me know if I should completely restructure here. I'm currently using a class that implements IHostedService for my program, and then that creates two separate WebApplications (two because they are listening in different directions, with different CORS settings, and one has a Controller, and the other has a SignalR Hub) What this means is that I have three different Builders at different parts of my code - one to create the initial program, and then one each for the two WebApplications. The issue I've hit upon is that I need to share some of the same singletons between these three. Is there a way to do this? Or is there a better way to set up the application across the board? Thanks
1 Reply
Hugh
HughOP2y ago
Ah, I could just pass the singleton into the next builder, couldn't I?
Want results from more Discord servers?
Add your server