开发者

Unity 2.0. How to throw ResolutionFailedException

I have my app, using functionality that is based on unity application block. Sometimes I need to throw ResolutionFailedException manually. In v1.2 constructor of ResolutionFailedException had three parameters - typerequested, namerequested and exception. In v2.0 fourth parameter was added - buildercontext. I'm not creating it manually, so I have no reference to it and no idea where I can get it. Roughly speaking, I'm only overriding Resolve method in particular way and I'm not interfere in standard mechanis开发者_如何学运维m of policies, strategies and so on. Could anyone help?


Actualy this exception is not supposed to be called by developer, anyway you can call it following way

    throw new ResolutionFailedException(
            typeof (IConcreteService), 
            "IConcreteService", 
            null, 
            new BuilderContext(null, null, null, null,                    NamedTypeBuildKey.Make<IConcreteService>("nameOrNullIfResolvedNotNamedInstance"), null)
            );
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜