views:

226

answers:

1

I am trying to create an object in Spring where one of its propertys is of type object. Now if I do the following:

<object id="MyObject" type="...." singleton=false>
   <property name="my_property" value="4">
</object>

Then the property my_property will be a string object. Is there a way do something like:

<object id="MyObject" type="...." singleton=false>
   <property name="my_property" value="4" type="System.Double, System">
</object>

I know this should probably be done by generics but we can't really add this in now as the person who wrote it didn't think of this at the time.

+2  A: 

You should be able to do this using the 'expression' tag. e.g.

<property name="my_property" expression="double.Parse('4')" />

See the Spring.NET documentation here

Tim Croydon