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


C# Database.DocumentDatabase类代码示例

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


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

示例1: 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

示例2: 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:aduggleby,项目名称:ravendb,代码行数:26,代码来源:BackupRestore.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: GeneralStorage

		public GeneralStorage()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
			});
		}
开发者ID:royra,项目名称:ravendb,代码行数:7,代码来源:GeneralStorage.cs

示例5: Esent

		public Esent()
		{
			db = new DocumentDatabase(new RavenConfiguration
			{
				DataDirectory = DataDir,
			});
		}
开发者ID:925coder,项目名称:ravendb,代码行数:7,代码来源:Esent.cs

示例6: AfterIncrementalBackupRestoreCanReadDocument

		public void AfterIncrementalBackupRestoreCanReadDocument()
		{
			db.Put("ayende", null, RavenJObject.Parse("{'email':'[email protected]'}"), new RavenJObject(), null);

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

			db.Put("itamar", null, RavenJObject.Parse("{'email':'[email protected]'}"), new RavenJObject(), null);
			db.StartBackup(BackupDir, true, new DatabaseDocument());
			WaitForBackup(db, true);

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

			DocumentDatabase.Restore(new RavenConfiguration
			{
				Settings =
				{
					{"Raven/Esent/CircularLog", "false"}
				}

			}, BackupDir, DataDir, s => { });

			db = new DocumentDatabase(new RavenConfiguration { DataDirectory = DataDir });

			var jObject = db.Get("ayende", null).ToJson();
			Assert.Equal("[email protected]", jObject.Value<string>("email"));
			jObject = db.Get("itamar", null).ToJson();
			Assert.Equal("[email protected]", jObject.Value<string>("email"));
		}
开发者ID:Trebornide,项目名称:ravendb,代码行数:30,代码来源:IncrementalBackupRestore.cs

示例7: ReplicateDatabaseCreation

        public void ReplicateDatabaseCreation( DocumentDatabase database )
        {
            InstanceDescription self = null;
            var replicationTargets = GetReplicationTargets(out self);

            if (replicationTargets != null)
            {
                log.Info("Ensuring default database {0} is replicated from {2} at {3}",string.IsNullOrWhiteSpace(database.Name) ? "Default" : database.Name, self.Id, self.InternalUrl);

                if (!string.IsNullOrWhiteSpace(database.Name))
                {
                    EnsureDatabaseExists(replicationTargets,database.Name);
                }

                var documentId = new ReplicationDocument().Id;

                var replicationDocument = new ReplicationDocument()
                {
                    Destinations =
                        replicationTargets
                        .Select(i => new ReplicationDestination() { Url = GetReplicationUrl(database.Name,i) })
                        .ToList()
                };

                database.Put(documentId, null, RavenJObject.FromObject(replicationDocument), new RavenJObject(), null);
            }
        }
开发者ID:skovborg,项目名称:RavenDb.Azure,代码行数:27,代码来源:CloudReplicationProvider.cs

示例8: DyanmicQueries

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

示例9: GeneralStorage

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

示例10: Initialize

		public override void Initialize(DocumentDatabase database)
		{
			settings = EncryptionSettingsManager.GetEncryptionSettingsForDatabase(database);


			EncryptionSettingsManager.VerifyEncryptionKey(database, settings);
		}
开发者ID:remcoros,项目名称:ravendb,代码行数:7,代码来源:DocumentEncryption.cs

示例11: QueryingOnStaleIndexes

		public QueryingOnStaleIndexes()
		{
			db = new DocumentDatabase(new RavenConfiguration { DataDirectory = "raven.db.test.esent", RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true });
			db.PutIndex(new RavenDocumentsByEntityName().IndexName, new RavenDocumentsByEntityName().CreateIndexDefinition());
		

		}
开发者ID:philiphoy,项目名称:ravendb,代码行数:7,代码来源:QueryingOnStaleIndexes.cs

示例12: Munin

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

示例13: BackupOperation

		public BackupOperation(DocumentDatabase database, IPersistentSource persistentSource, string src, string to)
		{
			this.database = database;
		    this.persistentSource = persistentSource;
		    this.to = to.ToFullPath();
            this.src = src.ToFullPath();
		}
开发者ID:nzdunic,项目名称:ravendb,代码行数:7,代码来源:BackupOperation.cs

示例14: AfterBackupRestoreCanReadDocument

		public void AfterBackupRestoreCanReadDocument()
		{
			db.Documents.Put("ayende", null, RavenJObject.Parse("{'email':'[email protected]'}"), new RavenJObject(), null);

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

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

			MaintenanceActions.Restore(new RavenConfiguration(), new DatabaseRestoreRequest
			{
				BackupLocation = BackupDir,
				DatabaseLocation = DataDir,
				Defrag = true
			}, s => { });

			db = new DocumentDatabase(new RavenConfiguration { DataDirectory = DataDir });

			var document = db.Documents.Get("ayende", null);
			Assert.NotNull(document);

			var jObject = document.ToJson();
			Assert.Equal("[email protected]", jObject.Value<string>("email"));
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:25,代码来源:BackupRestore.cs

示例15: IndexPropertyBatcher

			public IndexPropertyBatcher(DocumentDatabase database, IndexedPropertiesSetupDoc setupDoc, string index, AbstractViewGenerator viewGenerator)
			{
				this.database = database;
				this.setupDoc = setupDoc;
				this.index = index;
				this.viewGenerator = viewGenerator;
			}
开发者ID:arelee,项目名称:ravendb,代码行数:7,代码来源:IndexedPropertiesTrigger.cs


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