How do I avoid the service locator pattern? Should I?
问题 I'm currently working on a WinForms system (I know) where there's a lot of Constructor Injection when creating forms, but if those forms/views need to open another form, I find the DI container has been injected too so that we can locate the implementation of the desired view interface at runtime. e.g. public partial class MyView : Form, IMyView { private readonly IDIContainer _container; public MyView(IDIContainer container) { InitializeComponent(); _container = container; } public