PDA

View Full Version : Generics support in the "bleeding edge"


bittercoder
03-30-2007, 09:04 AM
Hi all,

I'm new to Spring.Net, but I was wondering what the current "bleeding edge" (from the nightly snapshot for instance) support is for generics?

For instance I tried registering a generic type, which relied in turn on another generic type (via a constructor dependency) and then tried wiring them up by supplying the missing type parameter ... as seen in the code below:


StaticApplicationContext context = new StaticApplicationContext();
context.RegisterPrototype("producer.default", typeof (GenericDefaultProducer<>), null);
IObjectDefinitionRegistry definitionRegistry = (IObjectDefinitionRegistry) context.ObjectFactory;
definitionRegistry.RegisterObjectDefinition("consumer",
new RootObjectDefinition(typeof (GenericConstructorConsumer<>),
AutoWiringMode.AutoDetect));

GenericConstructorConsumer<int> integerConsumer =
(GenericConstructorConsumer<int>)
context.GetObject("consumer", typeof (GenericConstructorConsumer<int>));


But it doesn't work... is there plan to implement support for these kinds of scenarios..?

(I'm trying to implement an IRepository<T> style pattern... )

Any help would be much appreciated...

Chez,

- Alex