[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






你可能感興趣的文章

如何使用 Python 實現 LRU Cache 快取置換機制

如何使用 Python 實現 LRU Cache 快取置換機制

不可不知的小工具-C#字串長度處理

不可不知的小工具-C#字串長度處理

優先性 與 相依性

優先性 與 相依性






留言討論