Open zadi0648 opened 6 months ago
You would need to register it like this:
builder.Register(theConcrete, Lifetime.Singleton)
.As(theInterface)
.AsSelf();builder.Register(theConcrete, Lifetime.Singleton)
.As(theInterface)
.AsSelf();
This way you also register theConcrete as itself, so you can resolve it.
If you have this:
This is fine:
Resolver.Resolve<IMyGeneric<double>>();
But this, albeit will be erroneous anyways, will throw a null reference exception:
Resolver.Resolve<MyGeneric<double>>();
Expected:
That a VContainerException is thrown instead, probably.
The Exception:
Also:
Most IoC Containers would have API similar to something like this:
The absence of a similar method within VContainer greatly confused me for some time, any chance it will be supported in the future? Or perhaps just a good example on how to bind a open generic interface to an open generic concrete, like at the top of this ticket, would have been very useful in the documentation.