[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






你可能感興趣的文章

Markdown 格式

Markdown 格式

ConQuest計分檔的分割函數

ConQuest計分檔的分割函數

JS註冊組|瀏覽器點擊上/下一頁時能重新刷新頁面

JS註冊組|瀏覽器點擊上/下一頁時能重新刷新頁面






留言討論