[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






你可能感興趣的文章

[React 04] props

[React 04] props

W11_資訊安全_XSS, SQL Injection, CSRF 及後端驗證_學習筆記整理

W11_資訊安全_XSS, SQL Injection, CSRF 及後端驗證_學習筆記整理

[Alpha Camp] 電商網頁切版初體驗

[Alpha Camp] 電商網頁切版初體驗






留言討論