I was just wondering if anyone has tried using IOC containers with WiseJ. I was playing around a little bit with SimpleInject and wasn’t sure how best to configure it.
Use the WinForms or WPF samples. I’m assuming the Container implementation is synchronized since they always declare it as static.
One error in the samples in the link is that it replaces the parameterless constructor. You can add and overload the constructor with the parameters receiving the different implementations, but always keep the parameterless constructor for inheritance and the designer.
And you have to be careful if you register a singleton since it will be reused by different sessions. Another way would be to create the container as a session instance instead of a static. In this case the singleton will be recreated in each session.
Currently using WiseJ with DryIOC. I’ve used the Winforms pattern but created some factory classes for UserControls and Forms.
Maybe it is more along the lines of how to do the integration for example if you follow this guide and use the same logic for WiseJ and I’m having issues getting it to work and so I don’t know if I need to be thinking more like it is a web api or web forms type app.
https://simpleinjector.readthedocs.io/en/latest/windowsformsintegration.html
Any .NET IOC Framework would work. There shouldn’t be anything different for a Wisej application than any .NET code. Without an IOC Framework complicating what should be simple, it’s just a combination of abstracting your implementation into interfaces and use factory classes and service providers in C#.
Please login first to submit.