I'm sure I'm doing something stupid but this is what we're here for!
I've got a WinForms app with the following code:
static void Main()
{
IKernel kernel = new StandardKernel(new MyModule());
TestInterface test = kernel.Get<TestInterface>();
}
For the Module.Load() event:
Bind<TestClass>().ToSelf().InSingletonScope();
Bind<TestInterface>().To<TestClass>();
At this point test
in the Main()
method is the proper object I'm expecting.
In a form later on, I'm using property injection:
[Inject]
TestInterface test {get;set;}
And once the form is loaded, trying to work with test
, but it's a null object.
Thoughts?