ipjohnson / Grace

Grace is a feature rich dependency injection container library
MIT License
336 stars 33 forks source link

Export generic interface with constraint(s) #292

Open mcdis opened 2 years ago

mcdis commented 2 years ago

Dear Johnson!

Can you tell me if I can export the generic interface given the constraints?

Example:

_.Export(typeof(ConfProvider<>)).As(typeof(IObservable<>).WithConstaints<IMsg>.Lifestyle.Singleton()

I want to bind IObservable<T> where IMsg to ConfProvider<T>

ipjohnson commented 2 years ago

Hi @mcdis,

You should be able to do When.MeetsCondition((strategy, staticContext) => /* inspect T using reflection here */)