[C# .NET6] AutoFac ADD implementation after DI Container Resolve


If you want to Add a implementation after DI Container resolved already,
you need to create a newBuilder and Update it to the original Container.

                var newBuilder = new ContainerBuilder();
                newBuilder.Register(c =>  new Car {Seats = GetSeats().Split(',') }).As<ICar>();
                newBuilder.Update(OriginalDIContainer);
#C# #.net6 #.net






你可能感興趣的文章

菜比八寫後端(1) - MySQL簡介

菜比八寫後端(1) - MySQL簡介

同步 & 非同步(5) - Promise.all 與 並行

同步 & 非同步(5) - Promise.all 與 並行

[BE201] Express & Sequelize part 5

[BE201] Express & Sequelize part 5






留言討論