public static void InitContainer()
        {
            var builder = new ContainerBuilder();
            var container = builder.Build();
            var typefinder = new WebAppDomainTypeFinder();

            builder = new ContainerBuilder();
            builder.RegisterInstance(typefinder).As<ITypeFinder>().SingleInstance();
            builder.Update(container);

            builder = new ContainerBuilder();
            var drtypes = typefinder.FindClassesOfType<IDependencyRegistrar>();
            var drInstances = new List<IDependencyRegistrar>();
            foreach (var drtype in drtypes)
            {
                drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drtype));
            }
            foreach (var dr in drInstances)
            {
                dr.Register(builder,typefinder);
            }

            builder.Update(container);
            //将Autofac容器中的实例注册到mvc自带的容器中
            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
            ContainerManager.RegisterContainer(container);
        }
        public static void InitContainer()
        {
            var builder = new ContainerBuilder();
            var container = builder.Build();
            var typefinder = new WebAppDomainTypeFinder();

            builder = new ContainerBuilder();
            builder.RegisterInstance(typefinder).As<ITypeFinder>().SingleInstance();
            builder.Update(container);

            builder = new ContainerBuilder();
            var drtypes = typefinder.FindClassesOfType<IDependencyRegistrar>();
            var drInstances = new List<IDependencyRegistrar>();
        }
        public static void InitContainer()
        {
            var builder = new ContainerBuilder();
            var container = builder.Build();
            var typefinder = new WebAppDomainTypeFinder();

            builder = new ContainerBuilder();
            builder.RegisterInstance(typefinder).As<ITypeFinder>().SingleInstance();
            builder.Update(container);

            builder = new ContainerBuilder();
            var drtypes = typefinder.FindClassesOfType<IDependencyRegistrar>();
            var drInstances = new List<IDependencyRegistrar>();
            foreach (var drtype in drtypes)
            {
                drInstances.Add((IDependencyRegistrar)Activator.CreateInstance(drtype));
            }
        }