Most arguments to my controller ctor, only being used as pass through to base controller, in Unity+MVC pattern, Any better ways?
public class MyController : Controller
{
public MyController(Obj1 obj1, Obj2 obj2, Obj3 obj3, Obj4 obj4, Obj5 obj5, Obj6 obj6)
{
// use all params
}
}
public class MyController : MyBaseController
{
public MyController(Obj1 obj1 .. Obj9 obj9) : base(obj1 .. obj6)
{
// use only two or three params, reset passed to base ctor
}
}
So the above is my situation, where my base controller needs most arguments, but I don't myself, and I feel it's cluterring my ctor, BUT! at the same time I don't wa开发者_如何转开发nt to use property injection, because my properties are made public, and I hate making things public if I don't need to.
Any ideas?
You could try using property injection instead. See http://msdn.microsoft.com/en-us/library/ff650198.aspx for more information.
精彩评论