simpleinjector / SimpleInjector

An easy, flexible, and fast Dependency Injection library that promotes best practice to steer developers towards the pit of success.
https://simpleinjector.org
MIT License
1.21k stars 155 forks source link

What would happen in case of duplicate registrations? #989

Closed amguilmet closed 7 months ago

amguilmet commented 7 months ago

In case of duplicate registrations like

services.AddScoped<IDbContextFactory<MyContext>, DbContextFactory<MyContext>>();
services.AddTransient<IDbContextFactory<MyContext>, DbContextFactory<MyContext>>();

There doesn't seem to be any run-time errors with this code when I try it. But what is the expected behavior of this?

dotnetjunkie commented 7 months ago

I'm confused by your question. You are asking a question on the Simple Injector forum, while the syntax you show is of a different DI Container, namely MS.DI. You need to give more context to this question before I'm able to answer it.