Closed f135ta closed 6 months ago
Hi @f135ta
Thank you for your suggestion. I assume you are referring to the event dispatcher classes that use the observer or mediator pattern. In my opinion, it is not uncommon to inject the IoC container, the IServiceProvider, to dynamically obtain references to the required handlers, especially for these patterns. Moreover, this approach helps avoid circular references by eliminating the need for direct dependencies. However, any pull requests or discussions are very welcome.
Unit tests have been added RtmpMessageDispatcher.Test.cs RtmpCommandDispatcher.Test.cs
You have a very interesting approach to dependency injection, and coding in general.
The IServiceProvider has tripped me up several times when trying to work with the code. The nested dependencies make it difficult to understand which classes are actually used and where.
I'd suggest removing the IServiceProvider references and actually using the dependency injection built into Net Core properly. It will make the code easier to use, easier to test and easier to understand.
Microsoft recommendation for not using IServiceProvider