Beispiel #1
0
        public static void Init()
        {
            var builder = new ContainerBuilder();

            builder.RegisterModule(new ConfigurationSettingsReader("autofac"));

            builder.RegisterControllers(Assembly.GetExecutingAssembly());
            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .AsImplementedInterfaces();

            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
            DiHelper.Register(container);
        }
Beispiel #2
0
 protected T Resolve <T>()
 {
     return(DiHelper.Resolve <T>());
 }