1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public class AutofacModuleRegister : Autofac.Module { protected override void Load(ContainerBuilder builder) { builder.RegisterAssemblyTypes(Assembly.Load("Power.Server")).Where(a => a.Name.EndsWith("Service")).AsImplementedInterfaces(); builder.RegisterAssemblyTypes(Assembly.Load("Power.Data")).Where(a => a.Name.EndsWith("Repository")).AsImplementedInterfaces();
builder.RegisterType<WxPayService>().Named<IPayService>(typeof(WxPayService).Name);
builder.RegisterType<AliPayService>().Named<IPayService>(typeof(AliPayService).Name);
builder.RegisterType<PowerControlConnectionStrings>().Named<IConnectionStrings>(typeof(PowerControlConnectionStrings).Name); } }
|