Exemplo n.º 1
0
        public void CoreServiceRegistryTest()
        {
            ServiceRegistry reg          = ApplicationServiceRegistryContainer.Create();
            IUserResolver   userResolver = reg.Get <IUserResolver>();

            Expect.IsNotNull(userResolver);
        }
Exemplo n.º 2
0
        public void CoreServiceRegistryCopyTest()
        {
            ServiceRegistry reg  = ApplicationServiceRegistryContainer.Create();
            Incubator       copy = new Incubator();

            copy.CopyFrom(reg);
            IUserResolver userResolver = copy.Get <IUserResolver>();

            Expect.IsNotNull(userResolver);
        }
Exemplo n.º 3
0
        internal static ServiceRegistry StartServer()
        {
            HostPrefix[] prefixes = GetConfiguredHostPrefixes();
            ILogger      logger   = GetLogger();

            Log.Default = logger;
            ServiceRegistry serviceRegistry = ApplicationServiceRegistryContainer.Create();

            server = serviceRegistry.Serve(prefixes, logger);
            return(serviceRegistry);
        }
Exemplo n.º 4
0
        public void CanCallCommand()
        {
            UserTestTools.SignUpAndLogin("CanCallCommand", out ServiceProxy.IHttpContext context, out UserAccounts.LoginResponse result);
            ServiceRegistry reg    = ApplicationServiceRegistryContainer.Create();
            ConsoleLogger   logger = new ConsoleLogger()
            {
                AddDetails = false
            };

            logger.StartLoggingThread();
            CommandService svc = reg.Get <CommandService>();

            svc.HttpContext = context;
            svc.Logger      = logger;
            ServiceResponse <CommandInfo> cmd = svc.Start("dir");

            OutLine(cmd.ToJson());
        }
Exemplo n.º 5
0
        public static ServiceRegistry Create()
        {
            AppConf       conf = new AppConf(BamConf.Load(ServiceConfig.ContentRoot), ServiceConfig.ProcessName.Or(RegistryName));
            DaoRepository repo = new DaoRepository(DataSettings.Current.GetSysDatabase(nameof(CatalogRepository)), Log.Default);

            repo.AddNamespace(typeof(CatalogItem));
            CatalogRepository catalogRepo = new CatalogRepository(repo, Log.Default);
            ServiceRegistry   coreReg     = ApplicationServiceRegistryContainer.Create();

            ServiceRegistry reg = (ServiceRegistry)(new ServiceRegistry())
                                  .For <ILogger>().Use(Log.Default)
                                  .For <AppConf>().Use(conf)
                                  .For <IRepository>().Use(catalogRepo)
                                  .For <DaoRepository>().Use(repo)
                                  .For <ICatalogService>().Use <CatalogService>()
                                  .For <CatalogService>().Use <CatalogService>();


            reg.CombineWith(coreReg);

            return(reg);
        }