Exemplo n.º 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            //IoC注册
            var assemblyFiles = Directory.GetFiles(Server.MapPath("bin/"), "*.dll");
            var assembly      = assemblyFiles.Select(a => a.Contains("Impl") ? Assembly.LoadFile(a) : null).ToList();

            assembly.RemoveAll(a => a == null);
            LocalServiceLocator.RegisterModules(assembly.ToArray());
            LocalServiceLocator.SetContainer();
        }