gpt4 book ai didi

caSTLe-windsor - 温莎城堡 : how to use a Type as constructor property in xml config?

转载 作者:行者123 更新时间:2023-12-02 00:46:50 27 4
gpt4 key购买 nike

我有以下内容:
类型用户:ITypeUser
{
public TypeUser(Type usedType){..}
}

如何在 windsor config xml 中配置 Type 参数?

最佳答案

对于自定义类型,您需要提供一个类型转换器来处理转换,但是开箱即用地支持“类型”(如果您查看 list here on the castleproject site )并且应该“正常工作”,即像这样:

<component id="myServer" service="SomeNameSpace.ITypeUser, SomeAssembly" type="SomeNameSpace.TypeUser, SomeLib">
<parameters>
<usedType>SomeNameSpace.MyOtherType, SomeAssembly</usedType>
</parameters>
</component>

关于caSTLe-windsor - 温莎城堡 : how to use a Type as constructor property in xml config?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/211656/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com