开发者

ArrayResolver in castle windsor behaves strangely

开发者 https://www.devze.com 2023-01-11 10:11 出处:网络
Im using windsor along with the subresolver ArrayResolver and works great besides one thing. Here the ArrayResolver works the the way it supposed to work.

Im using windsor along with the subresolver ArrayResolver and works great besides one thing.

Here the ArrayResolver works the the way it supposed to work.

class SomeClass : I开发者_JS百科SomeInterface
{
  public SomeClass(ISomeDependency[] dependecies)
  {}
}

This thing does not work

ISomeDependency[] = container.Resolve<ISomeDependency[]>().Cast<ISomeDependency>().ToArray()

, and this is why im asking, why isn't the sub resolver involved here?


because it's a sub Dependency resolver - it will resolve dependencies of the component you pull, not the component itself.

For that use

container.ResolveAll<ISomeDependency>();

0

精彩评论

暂无评论...
验证码 换一张
取 消