views:

111

answers:

1

I am successfully injecting base class properties with spring.net with just a class that inherits from a base abstract class. Lets say Class MyClass : MyBase, and I am successfully setting a property like this:

<object id="myInstantiableClass" type="myAssembly.MyClass myAssenbly" abstract="true">
    <property name="MyBaseClassProperty" ref="anotherObjRef"></property>
</object>

Where MyBaseClassProperty is a property on the base class.

Now I have another abstract class between the old base class and the instantiable class, and I am trying to set properties on both the abstract classes. So MyClass : MyNewBaseClass, and MyNewBaseClass : MyBaseClass. I have an additional property on the new base class (MyNewBaseClassProperty) and I am trying to inject it like this:

<object id="myInstantiableClass" type="myAssembly.MyClass myAssenbly" abstract="true">
    <property name="MyBaseClassProperty" ref="anotherObjRef"></property>
    <property name="MyNewBaseClassProperty" ref="someOtherObjRef"></property>
</object>

The property on the old base class is being injected but the one on the new one is not - and I am not getting an error or anything (so I am pretty sure my config is good), that property is just null!

I am on asp.net (not MVC) and the class MyClass is a user control (ascx).

Any help appreciated!

A: 

Did you try to to mark your object definition in your config file with abstract="false"? because you want to create an instance of MyClass or am I wrong?

Fabiano
yes, tried that - didn't work!
JohnIdol