Using microsoft’s DI we are able to inject a generic service as follows:
builder.Services.AddScoped(typeof(DBConnection<>));
this allows us to inject any DBConnection<T> without actually registering a DBConnection<T> for each T.
unfortunately I can’t find how to do it using wisej DI.
Any advise?
Best regards,
Ali
To update (late) this thread, generic services are supported since 3.5.4:
// Register generic service Application.Services.AddService(typeof(DBConnection<>)); // Request service var dbTrucks = Application.Services.GetService<DBConnection<Truck>>); var dbEmloyees = Application.Services.GetService<DBConnection<Employee>>);
Hi Ali,
did you check out our documentation at
https://docs.wisej.com/docs/concepts/dependency-injection
Best regards
Frank
Please login first to submit.