给定通用接口及其实现:
public interface IGenericInterface<T> { ... }
public class GenericImplementation<T> : IGenericInterface<T> { ... }
我正在注册此DI使用
当然,这很好用.但我想从appsettings.json
注入一个设置/配置,这就是我要解决的问题.
通常,我会使用services.AddTransient<IInterface>(x => new Implementation(x.GetRequiredService<IDependency>(), configuration["SomeSetting"]);
在type
注册依赖项时,是否可以将参数传递给依赖项?