Good day.
I have an interface:
public interface IRepository<T>
{
//Stuff
}
and an implementation:
class Repository<T> : IRepository<T>
{
//Stuff implementation
}
now I would like to bind it all together in a container.
I found Zenject to be somewhat similar no Ninject synthax-wise so I tried the following:
public class IoC : MonoInstaller
{
public override void InstallBindings()
{
Container.Bind(typeof(IRepository<>)).To(typeof(Repository<>));
}
}
This throws an exception when I try to validate the scene (Edit -> Zenject -> Validate Current Scenes):
Assert hit! Invalid type given during bind command.
Expected type 'Assets.Sources.Core.Infrastructure.Repository`1[T]' to derive from
type 'IRepository`1'
So I suspect this is just an incorrect way to do generic bindings. I wonder what the right one is.