How to carry out custom initialisation with autofac
问题 I'm adding autofac to an existing project and some of the service implementations require their Initialize method to be called and passed configuration information. Currently I'm using the code: builder.Register(context => { var service = new SqlTaxRateProvider(context.Resolve<IUserProvider>()); service.Initialize(config); return service; } ).As<ITaxService>() .SingleInstance(); which works but I'm still creating the object myself which is what I'm trying to get away from this and allow