Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void AddService(IServiceCollection services, TypeService typeService, Type scopedServiceType,
- Type transientServiceType, Type singletonServiceType)
- {
- if (scopedServiceType.IsAssignableFrom(typeService.Interface))
- services.AddScoped(typeService.Interface, typeService.Implementation);
- else if (transientServiceType.IsAssignableFrom(typeService.Interface))
- services.AddTransient(typeService.Interface, typeService.Implementation);
- else if (singletonServiceType.IsAssignableFrom(typeService.Interface))
- services.AddSingleton(typeService.Interface, typeService.Implementation);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement