在温莎城堡中传递附加参数

时间:2015-06-19 11:42:12

标签: c# inversion-of-control castle-windsor castle

是否可以使用Windsor IoC传递其他参数来解析类型?我知道有一种方法可以使用匿名args,但除了可以通过conatiner解析的其他构造函数参数之外,是否可以传递它?

例如,我的课程如下:

interface IService
{
    void methodA();
}

public class MyService (Iproductrespository a, ITenderRepository  b, object context) : IService
{    
    public void methodA()
    {
    }
    ....
}

现在我想使用Container.Resolve<IService>(new { id = 1 })来解决它。我的所有接口都注册了容器。

0 个答案:

没有答案