Comparison between Tiny Injector, Angular DI, and .Net DI
Tiny Injector#
Injector.AddSingleton(ServiceType);
Injector.AddSingleton(ServiceType, ServiceType);
Injector.AddSingleton(ServiceType, ImplementationType);
Injector.AddSingleton(ServiceType, implementationFactory);
.Net#
app.Services.AddSingleton<ServiceType>();
app.Services.AddSingleton<ServiceType, ServiceType>();
app.Services.AddSingleton<ServiceType, ImplementationType>();
app.Services.AddSingleton<ServiceType>(implementationFactory);
Angular#
providers: [
ServiceType,
{
provide: ServiceType,
useClass: ServiceType,
},
{
provide: ServiceType,
useClass: ImplementationType,
},
{
provide: ServiceType,
useFactory: implementationFactory,
},
];