Is IDependencyResolver an anti-pattern?

后端 未结 2 1597
忘掉有多难
忘掉有多难 2020-11-30 03:34

I am designing some architectural changes into a legacy ASP.NET application. I prototyped some classes for dependency resolution that mimic the ASP.NET MVC\'s IDependencyRes

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 03:50

    If you look at the signature you will see that it's just a Service Locator with another name. Service Locator is an anti-pattern and I consider the relationship transitive, so I consider IDependencyResolver an anti-pattern.

    Apart from that, the interface is also broken because it has no Release method.

提交回复
热议问题