Register partially open generic in simple injector

Viewed 730

I'm trying to register a open generic interface IService<T1> and to resolve it using the following partially open implementation class Service<T0, T1>. In this scenario, T0 would be fixed, and T1 from Service and IService would be the same.

Ideally, it would look something like this:

container.Register<IService<>, Service<ExplicitType,>>(Lifestyle.Singleton);

but that's incorrect c#.

My question is:

  • does that make sense ? Or is there a better way. I would like to avoid making the class Service<ExplicitType,> if possible.
  • is it even possible ?

I did not find the great documentation helpful on this matter.

1 Answers
Related