I have the following interface:
public interface IWriter<in TId, TViewModel>
For which there are a number of different implementations such as:
public class RedisWriter<TId, TViewModel> : IWriter<TId, TViewModel>
I'd like to be able to inject an instance of this class into the constructor of a service:
public class MyService : Service
{
private readonly IWriter<Guid, OrderViewModel> _writer;
public MyService(IWriter<Guid, OrderViewModel> writer)
{
_writer = writer;
}
}
Notice that generic type parameters are closed over where an instance is required.
I can't see any way to do this in Funq. Is it possible? Or do other IOCs allow this kind of use?