I have created an ASP.Net vNext Web API.
I have successfully used the dependency inection with a simple interface such as this:
services.AddScoped<ILinearRegressionCalculator, LinearRegressionCalculator>();
However, I can't figure out how to do dependency inection with a Generic Interface.
How do I setup dependency injection for this interface:
public interface IMongoConnectionHandler<T> where T : IMongoEntity
Following is an example:
services.TryAdd(ServiceDescriptor.Singleton(typeof(IOptions<>), typeof(OptionsManager<>)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.