Пример #1
0
 public void FromTextReader()
 {
     using (FileStream s = File.OpenRead(ZetboxConfig.GetDefaultConfigName(ConfigFile)))
     {
         TextReader   rd  = new StreamReader(s);
         ZetboxConfig cfg = ZetboxConfig.FromStream(rd);
         Assert.That(cfg.ConfigFilePath, Is.Null);
         CheckConfig(cfg);
     }
 }
Пример #2
0
        public void FromStream()
        {
            var filename = ZetboxConfig.GetDefaultConfigName(ConfigFile);

            Assert.That(filename, Is.Not.Empty);
            Assert.That(File.Exists(filename), Is.True, String.Format("configfile {0} doesn't exist", filename));

            using (FileStream s = File.OpenRead(filename))
            {
                ZetboxConfig cfg = ZetboxConfig.FromStream(s);
                Assert.That(cfg, Is.Not.Null);
                Assert.That(cfg.ConfigFilePath, Is.Null);
                CheckConfig(cfg);
            }
        }
Пример #3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            Logging.Configure();

            Log.Info("Starting HttpService Application");

            var cfgFile = System.Configuration.ConfigurationManager.AppSettings["ConfigFile"];

            var appBasePath = Server.MapPath("~/");
            var zbBasePath  = Path.Combine(appBasePath, "..");
            var configsPath = Path.Combine(zbBasePath, "Configs");

            var config = ZetboxConfig.FromFile(
                string.IsNullOrEmpty(cfgFile) ? string.Empty : Server.MapPath(cfgFile),
                ZetboxConfig.GetDefaultConfigName("Zetbox.Server.HttpService.xml", configsPath));

            // Make DocumentStore relative to HttpService
            config.Server.DocumentStore = Path.Combine(appBasePath, config.Server.DocumentStore);

            AssemblyLoader.Bootstrap(AppDomain.CurrentDomain, config);
            CreateMasterContainer(config);
        }