当前位置: 首页>>代码示例>>C#>>正文


C# InMemoryRavenConfiguration.Initialize方法代码示例

本文整理汇总了C#中InMemoryRavenConfiguration.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# InMemoryRavenConfiguration.Initialize方法的具体用法?C# InMemoryRavenConfiguration.Initialize怎么用?C# InMemoryRavenConfiguration.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InMemoryRavenConfiguration的用法示例。


在下文中一共展示了InMemoryRavenConfiguration.Initialize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryGetOrCreateResourceStore

        protected override bool TryGetOrCreateResourceStore(string tenantId, out IResourceStore database)
        {
            if (ResourcesStoresCache.TryGetValue(tenantId, out database))
                return true;

            var jsonDocument = DefaultDatabase.Get("Raven/Databases/" + tenantId, null);

            if (jsonDocument == null)
                return false;

            var document = jsonDocument.DataAsJson.JsonDeserialization<DatabaseDocument>();

            database = ResourcesStoresCache.GetOrAdd(tenantId, s =>
            {
                var config = new InMemoryRavenConfiguration
                {
                    Settings = DefaultConfiguration.Settings,
                };
                config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId;
                foreach (var setting in document.Settings)
                {
                    config.Settings[setting.Key] = setting.Value;
                }
                config.Initialize();
                return new DocumentDatabase(config);
            });
            return true;


        }
开发者ID:plasmaboyer,项目名称:ravendb,代码行数:30,代码来源:RavenDbHttpServer.cs

示例2: ModifyConfiguration

		protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration)
		{
			configuration.Settings["Raven/Esent/CircularLog"] = "false";
			configuration.Settings["Raven/Voron/AllowIncrementalBackups"] = "true";
			configuration.RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false;
			configuration.Initialize();
		}
开发者ID:cocytus,项目名称:ravendb,代码行数:7,代码来源:IncrementalBackupTest.cs

示例3: SubscriptionTests

 public SubscriptionTests()
 {
     configuration = new InMemoryRavenConfiguration
     {
         RunInMemory = true
     };
     configuration.Initialize();
     ravenMqServer = new RavenMqServer(configuration);
 }
开发者ID:nieve,项目名称:ravenmq,代码行数:9,代码来源:SubscriptionTests.cs

示例4: When_connecting_to_the_server_endpoint_will_get_error

 public void When_connecting_to_the_server_endpoint_will_get_error()
 {
     var configuration = new InMemoryRavenConfiguration
     {
         RunInMemory = true
     };
     configuration.Initialize();
     using(new RavenMqServer(configuration))
     using (var c = new ClientConnection(new IPEndPoint(IPAddress.Loopback, 8181), new CaptureClientIntegration()))
     {
         var e = Assert.Throws<AggregateException>(() => c.Connect().Wait());
         Assert.Equal("Invalid response signature from server", e.InnerException.Message);
     }
 }
开发者ID:nieve,项目名称:ravenmq,代码行数:14,代码来源:ConnectionTestsForErrors.cs

示例5: Isolated

		public void Isolated()
		{
			var ramDirectory = new RAMDirectory();
			using (new IndexWriter(ramDirectory, new StandardAnalyzer(Version.LUCENE_29), IndexWriter.MaxFieldLength.UNLIMITED)){}
			var inMemoryRavenConfiguration = new InMemoryRavenConfiguration();
			inMemoryRavenConfiguration.Initialize();
			;
			var simpleIndex = new SimpleIndex(ramDirectory, "test", new IndexDefinition
			{
				Map =
			                                                        	@"from s in docs.Softs select new { s.f_platform, s.f_name, s.f_alias,s.f_License,s.f_totaldownload}",
				Analyzers =
			                                                        	{
			                                                        		{"f_name", typeof (KeywordAnalyzer).AssemblyQualifiedName},
			                                                        		{"f_alias", typeof (KeywordAnalyzer).AssemblyQualifiedName},
			                                                        	},
				Indexes =
			                                                        	{
			                                                        		{"f_platform", FieldIndexing.NotAnalyzed},
			                                                        		{"f_License", FieldIndexing.NotAnalyzed},
			                                                        		{"f_totaldownload", FieldIndexing.NotAnalyzed},
			                                                        		{"f_name", FieldIndexing.Analyzed},
			                                                        		{"f_alias", FieldIndexing.Analyzed},
			                                                        	},
				SortOptions =
			                                                        	{
			                                                        		{"f_totaldownload", SortOptions.Int},
			                                                        		{"f_License", SortOptions.Int},
			                                                        	}

			}, new MapOnlyView(), new WorkContext()
			{
				Configuration = inMemoryRavenConfiguration
			});

			var perFieldAnalyzerWrapper = simpleIndex.CreateAnalyzer(new LowerCaseKeywordAnalyzer(), new List<Action>());

			var tokenStream = perFieldAnalyzerWrapper.TokenStream("f_name", new StringReader("hello Shrek"));
			while (tokenStream.IncrementToken())
			{
				var attribute = (TermAttribute) tokenStream.GetAttribute<ITermAttribute>();
				Assert.Equal("hello Shrek", attribute.Term);
			}
		}
开发者ID:jon-adams,项目名称:ravendb,代码行数:44,代码来源:WiseShrek.cs

示例6: CreatePrefetcher

        protected PrefetcherWithContext CreatePrefetcher(Action<InMemoryRavenConfiguration> modifyConfiguration = null, Action<WorkContext> modifyWorkContext = null)
        {
            var configuration = new InMemoryRavenConfiguration
            {
                RunInMemory = true
            };

            configuration.Initialize();

            if (modifyConfiguration != null)
                modifyConfiguration(configuration);

            var transactionalStorage = new TransactionalStorage(configuration, () => { }, () => { }, () => { }, () => { });
            transactionalStorage.Initialize(new SequentialUuidGenerator { EtagBase = 0 }, new OrderedPartCollection<AbstractDocumentCodec>());

            var workContext = new WorkContext
            {
                Configuration = configuration,
                TransactionalStorage = transactionalStorage
            };

            if (modifyWorkContext != null)
                modifyWorkContext(workContext);

            var autoTuner = new IndexBatchSizeAutoTuner(workContext);

            var prefetchingBehavior = new PrefetchingBehavior(PrefetchingUser.Indexer, workContext, autoTuner, string.Empty);

            var prefetcherWithContext = new PrefetcherWithContext
                                        {
                                            AutoTuner = autoTuner,
                                            Configuration = configuration,
                                            PrefetchingBehavior = prefetchingBehavior,
                                            TransactionalStorage = transactionalStorage,
                                            WorkContext = workContext
                                        };

            createdPrefetchers.Add(prefetcherWithContext);

            return prefetcherWithContext;
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:41,代码来源:PrefetcherTestBase.cs

示例7: ConvertToRavenConfiguration

        public InMemoryRavenConfiguration ConvertToRavenConfiguration()
        {
            var configuration = new InMemoryRavenConfiguration();

            foreach (var p in ConfigurationManager.AppSettings.AllKeys.Select(k => Tuple.Create(k, ConfigurationManager.AppSettings[k])))
            {
                configuration.Settings.Add(p.Item1, p.Item2);
            }

            foreach (var key in Settings.Keys)
            {
                configuration.Settings.Add(key, Settings[key]);
            }

            configuration.Initialize();

            configuration.Port = Port;
            configuration.RunInMemory = RunInMemory;
            configuration.DefaultStorageTypeName = DefaultStorageTypeName;

            return configuration;
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:22,代码来源:ServerConfiguration.cs

示例8: TryGetOrCreateResourceStore

		protected override bool TryGetOrCreateResourceStore(string tenantId, out IResourceStore database)
		{
			if (ResourcesStoresCache.TryGetValue(tenantId, out database))
				return true;

			JsonDocument jsonDocument;

			using (DefaultDatabase.DisableAllTriggersForCurrentThread())
				jsonDocument = DefaultDatabase.Get("Raven/Databases/" + tenantId, null);

			if (jsonDocument == null)
				return false;

			var document = jsonDocument.DataAsJson.JsonDeserialization<DatabaseDocument>();

			database = ResourcesStoresCache.GetOrAddAtomically(tenantId, s =>
			{
				var config = new InMemoryRavenConfiguration
				{
					Settings = DefaultConfiguration.Settings,
				};
				foreach (var setting in document.Settings)
				{
					config.Settings[setting.Key] = setting.Value;
				}
				var dataDir = config.Settings["Raven/DataDir"];
				if (dataDir == null)
					throw new InvalidOperationException("Could not find Raven/DataDir");
				if (dataDir.StartsWith("~/") || dataDir.StartsWith(@"~\"))
				{
					var baseDataPath = Path.GetDirectoryName(DefaultDatabase.Configuration.DataDirectory);
					if (baseDataPath == null)
						throw new InvalidOperationException("Could not find root data path");
					config.Settings["Raven/DataDir"] = Path.Combine(baseDataPath, dataDir.Substring(2));
				}
				config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId;

				config.DatabaseName = tenantId;

				config.Initialize();
				var documentDatabase = new DocumentDatabase(config);
				documentDatabase.SpinBackgroundWorkers();
				return documentDatabase;
			});
			return true;
		}
开发者ID:JPT123,项目名称:ravendb,代码行数:46,代码来源:RavenDbHttpServer.cs

示例9: CreateTenantConfiguration

		public InMemoryRavenConfiguration CreateTenantConfiguration(string tenantId)
		{
			var document = GetTenantDatabaseDocument(tenantId);
			if (document == null)
				return null;

			var config = new InMemoryRavenConfiguration
			{
				Settings = new NameValueCollection(SystemConfiguration.Settings),
			};

			SetupTenantDatabaseConfiguration(config);

			config.CustomizeValuesForTenant(tenantId);


			foreach (var setting in document.Settings)
			{
				config.Settings[setting.Key] = setting.Value;
			}
			Unprotect(document);

			foreach (var securedSetting in document.SecuredSettings)
			{
				config.Settings[securedSetting.Key] = securedSetting.Value;
			}

			var dataDir = document.Settings["Raven/DataDir"];
			if (dataDir.StartsWith("~/") || dataDir.StartsWith(@"~\"))
			{
				var baseDataPath = Path.GetDirectoryName(SystemDatabase.Configuration.DataDirectory);
				if (baseDataPath == null)
					throw new InvalidOperationException("Could not find root data path");
				config.Settings["Raven/DataDir"] = Path.Combine(baseDataPath, dataDir.Substring(2));
			}
			config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId;

			config.DatabaseName = tenantId;
			config.IsTenantDatabase = true;

			config.Initialize();
			config.CopyParentSettings(SystemConfiguration);
			return config;
		}
开发者ID:urbanfly,项目名称:ravendb,代码行数:44,代码来源:HttpServer.cs

示例10: ApplySettingsToConfiguration

        public static void ApplySettingsToConfiguration(InMemoryRavenConfiguration configuration)
        {
            var settings = ServerSettings;
            foreach (var setting in settings)
            {
                Console.WriteLine("Applying external server setting: " + setting.Key);

                configuration.Settings[setting.Key] = setting.Value;
            }

            configuration.Initialize();
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:12,代码来源:ConfigurationHelper.cs

示例11: ApplySettingsToConfiguration

        public static void ApplySettingsToConfiguration(InMemoryRavenConfiguration configuration)
        {
            var settings = Settings;
            foreach (var setting in settings)
            {
                configuration.Settings[setting.Key] = setting.Value;
            }

            configuration.Initialize();
        }
开发者ID:nuvotex,项目名称:ravendb,代码行数:10,代码来源:ConfigurationHelper.cs


注:本文中的InMemoryRavenConfiguration.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。