Closed GoogleCodeExporter closed 9 years ago
Unfortunately, I wasn't able to reproduce the bug, but I did add the following
tests
that verify that the bug doesn't actually exist:
[Test]
public void
ContainerShouldBeAbleToRegisterGenericTypeAndResolveConcreteServiceType()
{
var container = new ServiceContainer();
container.AddService(typeof(ISampleGenericService<>),
typeof(SampleGenericClassWithOpenGenericImplementation<>));
var instance = container.GetService<ISampleGenericService<int>>();
Assert.IsNotNull(instance);
}
[Test]
public void
ContainerShouldBeAbleToRegisterGenericTypeAndResolveConcreteServiceTypeUsingTheN
onGen
ericGetServiceMethod()
{
var container = new ServiceContainer();
container.AddService(typeof(ISampleGenericService<>),
typeof(SampleGenericClassWithOpenGenericImplementation<>));
var instance = container.GetService(typeof(ISampleGenericService<int>));
Assert.IsNotNull(instance);
}
Both of these tests passed, and you can find them in
InversionOfControlTests.cs. The
latest version of LinFu.IOC v2.0 can be found in the Github repository using
the
following link:
http://github.com/philiplaureano/LinFu
Try it out and let me know if it helps.
Regards,
Philip Laureano
Original comment by Philip.L...@gmail.com
on 28 Apr 2010 at 10:43
I took a look at the bug again and I managed to reproduce it with the Linfu CSL
adapter, but the problem is that modifying the adapter to support resolving
concrete
generic instantiations from generic service types would be non-standard
behavior for
the CSL adapters.
In other words, not all the other containers are capable of doing what LinFu
does
with generics, and while LinFu itself can easily handle the behavior that you
mentioned, it needs to conform to the Common Service Locator spec, so
unfortunately,
I won't be able to fix this without breaking the CSL implementation.
Original comment by Philip.L...@gmail.com
on 28 Apr 2010 at 11:25
Where can I find these specs? The CSL page says "The project contains a full
test
suite", which I couldn't find, the API reference says nothing about generic
types (it
only says the container should return a type that implements the requested
interface),
and other adapters (like the Castle.Windsor based one) doesn't seem to care
either.
Original comment by szt...@gmail.com
on 29 Apr 2010 at 7:34
Original issue reported on code.google.com by
szt...@gmail.com
on 28 Apr 2010 at 7:12