asp.net-mvc-3castle-windsorproperty-injection

Castle Windsor automatic property injection of non-public property


I've setup Castle Windsor in my ASP.NET Mvc 3 project and added the following property on HomeController:

    private IUserService UserService
    {
        get;
        set;
    }

When I try using UserService in an action method it's always null. But, if I change the property to public it gets automatically instantiated by Castle Windsor.

Is it possible to have automatic property injection with non-public properties?


Solution

  • No it is not possible for the reason that @Mauricio Scheffer comment outlines