views:

90

answers:

2

Is there a way to get the string representation of an interface using Spring.NET?

In code:

typeof(ISsoUrlTemplateRepository).Name

I would need this name in Spring.NET configuration... I could just take the string itself but if I would ever refactor and change the names of some interfaces, the Spring configuration wouldn't work anymore.

This relates to another question I've asked --> http://stackoverflow.com/questions/2034374/configure-static-properties-with-spring-net

A: 

By using

typeof(ISsoUrlTemplateRepository).AssemblyQualifiedName

Which includes full type name, plus assembly name from which that was loaded.

Rubens Farias
+2  A: 

To get a typename in your Spring.NET config you need to use Spring Expression language.

Like so:

<object id="MyClass" type="Assembly.Type, Assembly">
    <property name ="MyTypeProperty" value="T(AnotherAssembly.AnotherType, AnotherAssembly)"/>        
 </object>
BennyM
Benny, looks like you've been using Spring.NET a lot. Thx for all your answers.
Lieven Cardoen