Auto wiring of Property does not work for me
- by Xabatcha
Hi All,
In my Asp.Net project I wanna use Property Auto-wiring, e.g. for my ILogger. Basically I placed Property into my base classes. One for Page, one for UserControl. Like below.
public class UserControlBase : UserControl
{
public ILogger CLogger { get; set; }
....
}
However when calling in inherited control, logger is null. I checked the container and it'a definitely set. Below is setting which is called from Global.asax.
public static void SetupForIoC()
{
Debug.WriteLine("SetupForIoC");
ObjectFactory.Initialize(x =>
{
x.FillAllPropertiesOfType<ILogger>().TheDefaultIsConcreteType<EntLibLogger>().AsSingletons();
x.FillAllPropertiesOfType<ISiteService>().TheDefaultIsConcreteType<SiteService>().AsSingletons();
});
Debug.WriteLine(ObjectFactory.WhatDoIHave());
}
Thanks for any advice, tip? X.