I may not have understood the concept of dependency injection but here is the question.
I have created a ServiceLocator class that configures the container with the dependent objects.
The startup object for my application is Form1.vb (lets say). I have set this in the project properties.
If i want to get hold of a LogWriter in Form1.Vb, how would i go about doing this?
the ServiceLocator looks like this
Private Shared Sub ConfigureContainer()
_container = New UnityContainer
_container.RegisterType(Of IExtractor, CSONYExtractor)(Constants.SONY)
In my client tools, this is what i have done.
Private _logWriter As LogWriter
Public Sub New(ByVal logWriter As LogWriter)
_logWriter = logWriter
Any advice on this would be very helpful.