In order to access the underlying data source, I need to provide the current user credentials which I don't have beforehand.
So, in order to provide the data access layer with proper current user credentials, I have been suggested that my ConfigurationProvider
would depend on an instance of ICurrentUser
InSingletonScope()
as per this answer
.
The way I understand it, I shall make sure about authenticating the user, and bind my ICurrentUser
afterwards, and binding the rest of my data access layer.
As the authentication occurs in my main MDI form, the only way I can see to achieve it, is to inject the Ninject kernel into the constructor of my MDI form.
My concern is about the fact that the way I see it, it would be necessary to depend on the Ninject kernel itself, which is absolutely out of the question, since this would then be, if I am not mistaken, just like using the ServiceLocator
anti-pattern.
So, in this scenario, how to avoid the ServiceLocator
anti-pattern?