4
votes

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?

1
If you can't set the property, why should Windsor be able to set it? Badly designed IMHO.Mauricio Scheffer
I agree. I just wanted to check since I couldn't find any info on it.Lester
It is possible to craft some hack to work around it... it's just not worth it IMHO.Mauricio Scheffer

1 Answers

1
votes

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