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


C# DocumentDatabase.SpinBackgroundWorkers方法代码示例

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


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

示例1: RavenDbServer

        public RavenDbServer(RavenConfiguration settings)
        {
            settings.LoadLoggingSettings();
            if (settings.ShouldCreateDefaultsWhenBuildingNewDatabaseFromScratch)
                settings.DatabaseCreatedFromScratch += OnDatabaseCreatedFromScratch;
            database = new DocumentDatabase(settings);
            database.SpinBackgroundWorkers();
            server = new HttpServer(settings,
                                    typeof (RequestResponder).Assembly.GetTypes()
                                        .Where(
                                            t => typeof (RequestResponder).IsAssignableFrom(t) && t.IsAbstract == false)

                                        // to ensure that we would get consistent order, so we would always
                                        // have the responders using the same order, otherwise we get possibly
                                        // random ordering, and that might cause issues
                                        .OrderBy(x => x.Name)
                                        .Select(t => (RequestResponder) Activator.CreateInstance(t))
                                        .Select(r =>
                                        {
                                            r.Database = database;
                                            r.Settings = settings;
                                            return r;
                                        })
                );
            server.Start();
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:26,代码来源:RavenDbServer.cs

示例2: Init

        public static void Init()
        {
            if (database != null)
                return;

            lock (locker)
            {
                if (database != null)
                    return;

                try
                {
                    var ravenConfiguration = new RavenConfiguration();
                    if (RoleEnvironment.IsAvailable)
                    {
                        ravenConfiguration.RunInMemory = true;
                        // Mount Cloud drive and set it as Data Directory
                        //var currentConfiguredRavenDataDir = ConfigurationManager.AppSettings["Raven/DataDir"] ?? string.Empty;
                        //string azureDrive = @"D:\"; // Environment.GetEnvironmentVariable(RavenDriveConfiguration.AzureDriveEnvironmentVariableName, EnvironmentVariableTarget.Machine);
                        //if (string.IsNullOrWhiteSpace(azureDrive))
                        //{
                        //    throw new ArgumentException("RavenDb drive environment variable is not yet set by worker role. Please, retry in a couple of seconds");
                        //}

                        //string azurePath = Path.Combine(azureDrive,
                        //    currentConfiguredRavenDataDir.StartsWith(@"~\")
                        //        ? currentConfiguredRavenDataDir.Substring(2)
                        //        : "Data");
                        //ravenConfiguration.DataDirectory = azurePath;

                        // Read port number specified for this Raven instance and set it in configuration
                        var endpoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Raven"];
                        ravenConfiguration.Port = endpoint.IPEndpoint.Port;

                        // When mounting drives in emulator only Munin storage is supported, since drive is not actually present and low level access to it failes (Esent mode)
                    }
                    HttpEndpointRegistration.RegisterHttpEndpointTarget();
                    database = new DocumentDatabase(ravenConfiguration);
                    database.SpinBackgroundWorkers();
                    server = new HttpServer(ravenConfiguration, database);
                    server.Init();
                }
                catch
                {
                    if (database != null)
                    {
                        database.Dispose();
                        database = null;
                    }
                    if (server != null)
                    {
                        server.Dispose();
                        server = null;
                    }
                    throw;
                }

                HostingEnvironment.RegisterObject(new ReleaseRavenDBWhenAppDomainIsTornDown());
            }
        }
开发者ID:thatpaulschofield,项目名称:LifeMap,代码行数:60,代码来源:ForwardToRavenRespondersFactory.cs

示例3: AfterBackupRestoreCanQueryIndex_CreatedAfterRestore

		public void AfterBackupRestoreCanQueryIndex_CreatedAfterRestore()
		{
			db.Put("ayende", null, RavenJObject.Parse("{'email':'[email protected]'}"), RavenJObject.Parse("{'Raven-Entity-Name':'Users'}"), null);

			db.StartBackup(BackupDir, false, new DatabaseDocument());
			WaitForBackup(db, true);

			db.Dispose();
			IOExtensions.DeleteDirectory(DataDir);

			DocumentDatabase.Restore(new RavenConfiguration(), BackupDir, DataDir, s => { }, defrag: true);

			db = new DocumentDatabase(new RavenConfiguration { DataDirectory = DataDir });
			db.SpinBackgroundWorkers();
			QueryResult queryResult;
			do
			{
				queryResult = db.Query("Raven/DocumentsByEntityName", new IndexQuery
				{
					Query = "Tag:[[Users]]",
					PageSize = 10
				}, CancellationToken.None);
			} while (queryResult.IsStale);
			Assert.Equal(1, queryResult.Results.Count);
		}
开发者ID:925coder,项目名称:ravendb,代码行数:25,代码来源:BackupRestore.cs

示例4: Init

		public static void Init()
		{
			if (database != null)
				return;

			lock (locker)
			{
				if (database != null)
					return;

				try
				{
					var ravenConfiguration = new RavenConfiguration();
					HttpEndpointRegistration.RegisterHttpEndpointTarget();
					database = new DocumentDatabase(ravenConfiguration);
					database.SpinBackgroundWorkers();
					server = new HttpServer(ravenConfiguration, database);
					server.Init();
				}
				catch
				{
					if (database != null)
					{
						database.Dispose();
						database = null;
					}
					if (server != null)
					{
						server.Dispose();
						server = null;
					}
					throw;
				}
			}
		}
开发者ID:pjboudrx,项目名称:ravendb,代码行数:35,代码来源:ForwardToRavenRespondersFactory.cs

示例5: AfterBackupRestoreCanQueryIndex_CreatedAfterRestore

        public void AfterBackupRestoreCanQueryIndex_CreatedAfterRestore()
        {
            db.Put("ayende", null, JObject.Parse("{'email':'[email protected]'}"), JObject.Parse("{'Raven-Entity-Name':'Users'}"), null);

            db.StartBackup("raven.db.test.backup");
            WaitForBackup();

            db.Dispose();

            DeleteIfExists("raven.db.test.esent");

            DocumentDatabase.Restore(new RavenConfiguration(), "raven.db.test.backup", "raven.db.test.esent");

            db = new DocumentDatabase(new RavenConfiguration { DataDirectory = "raven.db.test.esent" });
            db.SpinBackgroundWorkers();
            QueryResult queryResult;
            do
            {
                queryResult = db.Query("Raven/DocumentsByEntityName", new IndexQuery
                {
                    Query = "Tag:[[Users]]",
                    PageSize = 10
                });
            } while (queryResult.IsStale);
            Assert.Equal(1, queryResult.Results.Count);
        }
开发者ID:vinone,项目名称:ravendb,代码行数:26,代码来源:BackupRestore.cs

示例6: RavenDbServer

		public RavenDbServer(RavenConfiguration settings)
		{
			settings.LoadLoggingSettings();
			database = new DocumentDatabase(settings);
			database.SpinBackgroundWorkers();
			server = new HttpServer(settings, database);
			server.Start();
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:8,代码来源:RavenDbServer.cs

示例7: SpatialIndexTest

		public SpatialIndexTest()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				RunInMemory = true
			});
			db.SpinBackgroundWorkers();
		}
开发者ID:925coder,项目名称:ravendb,代码行数:8,代码来源:SpatialIndexTest.cs

示例8: ParameterisedDynamicQuery

 public ParameterisedDynamicQuery()
 {
     db = new DocumentDatabase(new RavenConfiguration
         {
             DataDirectory = "raven.db.test.esent",
         });
     db.SpinBackgroundWorkers();
 }
开发者ID:VirtueMe,项目名称:ravendb,代码行数:8,代码来源:ParameterisedDynamicQuery.cs

示例9: SpatialIndex

		public SpatialIndex()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = "raven.db.test.esent",
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
			});
			db.SpinBackgroundWorkers();
		}
开发者ID:Titaye,项目名称:ravendb,代码行数:9,代码来源:SpatialIndex.cs

示例10: ComplexIndexOnNotAnalyzedField

		public ComplexIndexOnNotAnalyzedField()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
			});
			db.SpinBackgroundWorkers();
		}
开发者ID:neiz,项目名称:ravendb,代码行数:9,代码来源:ComplexIndexOnNotAnalyzedField.cs

示例11: MapReduce

		public MapReduce()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
				RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
			});
			db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.NotAnalyzed}}});
			db.SpinBackgroundWorkers();
		}
开发者ID:neiz,项目名称:ravendb,代码行数:10,代码来源:MapReduce.cs

示例12: CompiledIndex

 public CompiledIndex()
 {
     db = new DocumentDatabase(new RavenConfiguration
     {
         DataDirectory = "raven.db.test.esent",
         RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
         Catalog = { Catalogs = { new TypeCatalog(typeof(ShoppingCartEventsToShopingCart), typeof(MapOnlyView)) } }
     });
     db.SpinBackgroundWorkers();
 }
开发者ID:nzdunic,项目名称:ravendb,代码行数:10,代码来源:CompiledIndex.cs

示例13: IndexTriggers

 public IndexTriggers()
 {
     db = new DocumentDatabase(new RavenConfiguration
     {
         DataDirectory = "raven.db.test.esent",
         Container = new CompositionContainer(new TypeCatalog(
             typeof(IndexToDataTable))),
         RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
     });
     db.SpinBackgroundWorkers();
 }
开发者ID:kenegozi,项目名称:ravendb,代码行数:11,代码来源:IndexTriggers.cs

示例14: ForwardToRavenRespondersFactory

		static ForwardToRavenRespondersFactory()
		{
			lock (locker)
			{
				if (database != null)
					return;

				database = new DocumentDatabase(ravenConfiguration);
				database.SpinBackgroundWorkers();
				server = new RavenDbHttpServer(ravenConfiguration, database);
			}
		}
开发者ID:philiphoy,项目名称:ravendb,代码行数:12,代码来源:ForwardToRavenRespondersFactory.cs

示例15: MapReduce

        public MapReduce()
        {
            db = new DocumentDatabase(new RavenConfiguration {DataDirectory = "raven.db.test.esent"});
            db.PutIndex("CommentsCountPerBlog", new IndexDefinition{Map = map, Reduce = reduce, Indexes = {{"blog_id", FieldIndexing.Untokenized}}});
            db.SpinBackgroundWorkers();

            BasicConfigurator.Configure(
                new OutputDebugStringAppender
                {
                    Layout = new SimpleLayout()
                });
        }
开发者ID:torkelo,项目名称:ravendb,代码行数:12,代码来源:MapReduce.cs


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