I have a hopefully simple question...
I am trying to change over from the XML registration to the Fluent Registration API, but am having one problem with registering objects that require an array as a constructor parameter.
For example
<component id="Example" lifestyle="transient"
service="Test, Example.Test"
type="Test, Example.Test">
<paramete开发者_如何学Crs>
<C>
<array>
<item>Value One</item>
<item>Value Two</item>
</array>
</C>
</parameters>
</component>
How would I go about registering this with the fluent api?
//the constructor for test is Test(string[] C){}
_container.Register(Component.For<Test>().ImplementedBy<Test>().Parameters(
Parameter
.ForKey("C")
.Eq(new string[]{"Value one","Value two"})
));
IIRC it's something like this:
_container.Register(Component.For<Test>().ImplementedBy<Test>().DependsOn(
Property
.ForKey("C")
.Eq(new string[]{"Value one","Value two"})
));
See the fluent registration wiki for more information.
精彩评论