Hi all.
I have a common datacontainer interface IDataContainer
I use it for different types of T IPerson, ISuperMan etc
In castle i regsiter it with
container.AddComponentWithLifestyle<IDataContainer<IPerson>, DataContainer<Person>>(LifestyleType.Transient);
container.AddComponentWithLifestyle<IDataContainer<ISuperMan>, DataContainer<SuperMan>>(LifestyleType.Transient);
at runtime castle creates the dependency with eg.
IDataContainer<IPerson> test = container.GetService<IDataContainer<IPerson>>();
but it fails with an unable to cast...the classes implements the interface and namespaces are correct etc.
The call
IPerson test = container.GetService<IPerson>();
Works (with the registration of <IPerson,Person>
)
Cant castle resolve an interface<T>
or ?