示例#1
0
        public static void LoadHostedApps(Assembly hostedAssembly, bool loadModules, AppCoreBuilder coreBuilder)
        {
            Log.DebugFormat("Сканирование сборки {0}. Загружать модули: {1}", hostedAssembly.FullName, loadModules);
            if (loadModules)
                coreBuilder.Configure(b => b.RegisterAssemblyModules(hostedAssembly));

            coreBuilder.Configure(b => b.RegisterAssemblyTypes(hostedAssembly)
                                        .AssignableTo<IHostedApp>()
                                        .AsImplementedInterfaces()
                                        .AsSelf());
        }
示例#2
0
        public static void LoadHostedApps(Assembly hostedAssembly, bool loadModules, AppCoreBuilder coreBuilder)
        {
            Log.DebugFormat("Сканирование сборки {0}. Загружать модули: {1}", hostedAssembly.FullName, loadModules);
            if (loadModules)
            {
                coreBuilder.Configure(b => b.RegisterAssemblyModules(hostedAssembly));
            }

            coreBuilder.Configure(b => b.RegisterAssemblyTypes(hostedAssembly)
                                  .AssignableTo <IHostedApp>()
                                  .AsImplementedInterfaces()
                                  .AsSelf());
        }
示例#3
0
        public static AppCoreBuilder GetBuilder()
        {
            if (_coreBuilder == null)
            {
                _coreBuilder = AppCoreBuilder.Create()
                               .Configure(b => b.RegisterType <Config>().AsSelf().SingleInstance());
            }
            var cfg = ConfigurationManager.GetSection("HostConfig") as HostConfig ?? new HostConfig();

            _coreBuilder.Configure(b => b.Register(ctx => cfg).As <HostConfig>().SingleInstance());
            if (!cfg.ScanAll)
            {
                Log.Debug("Загрузка приложений из списка");
                foreach (HostedAppElement hostedApp in cfg.HostedApps)
                {
                    LoadHostedApps(hostedApp.HostedAssembly, hostedApp.LoadModules, _coreBuilder);
                }
            }
            else
            {
                Log.Debug("Загрузка всех приложений из сборок загруженных в домен");
                foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    LoadHostedApps(assembly, true, _coreBuilder);
                }
            }
            return(_coreBuilder);
        }
 public static AppCoreBuilder RegisterProviders(this AppCoreBuilder builder)
 {
     builder.Configure(b =>
     {
         b.RegisterModelBinderProvider();
         b.RegisterFilterProvider();
     });
     return(builder);
 }
 public static AppCoreBuilder RegisterControllersAndBinders(this AppCoreBuilder builder, params Assembly[] asm)
 {
     builder.Configure(b =>
     {
         b.RegisterControllers(asm);
         b.RegisterModelBinders(asm);
         b.RegisterFilterProvider();
     });
     return(builder);
 }