[英]Castle Windsor dependency injection to properties
I am trying to add something (I don't know what that something is) to Castle Windsor that will detect when I'm trying to create an instance of a class that derives from System.Activities.Activity
, Windsor would inspect the properties of type InArgument<T>
and resolve values for these arguments before returning the created instance to the callee. 我正在尝试向Castle Windsor添加一些(我不知道那是什么),以便在我尝试创建派生自System.Activities.Activity
的类的实例时进行检测,Windsor会检查键入InArgument<T>
并解析这些参数的值,然后再将创建的实例返回给被调用方。
What are the steps for doing something like this? 做这样的事情有哪些步骤?
Basically, I would have something like this: 基本上,我会有这样的事情:
var someActivity = container.Resolve<SomeActivity>();
Then Windsor would detect that SomeActivity
derives from Activity
, it would inspect the properties of type InArgument<T>
on SomeActivity
and would resolve values for those properties from the container itself. 然后将温莎检测SomeActivity
派生自Activity
,它将检查类型的属性InArgument<T>
上SomeActivity
和将解析值用于从容器本身的那些属性。
But SomeActivity
could be any Activity
, not necessarily specifically SomeActivity
. 但是SomeActivity
可以是任何Activity
,而不一定是SomeActivity
。
温莎默认情况下会设置它可以解析的所有属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.