Passing an Arbitrary Value to a Lifetime Manager

Dec 1, 2010 at 10:49 AM


Is it possible to pass an arbitrary value to a lifetime manager using the XML configuration?

If I add some property to the <lifetime /> declaration I get a runtime error, which is expected, since my property is not part of the expected schema, but I was wondering if there is some way do to it.

Of course, I could also use the <appSettings/>, but I wanted to make it more self-contained.

Thanks again!


Dec 2, 2010 at 5:12 AM

What you can do is write a custom TypeConverter that can then consume the string you pass in the <lifetime value="some string"/> attribute. The TypeConverter creates the actual lifetime manager and can do whatever it wants with the string.