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


C# IDatabaseCommands.Get方法代码示例

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


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

示例1: GetWindowsAuthDocument

 static WindowsAuthDocument GetWindowsAuthDocument(IDatabaseCommands systemCommands)
 {
     var existing = systemCommands.Get("Raven/Authorization/WindowsSettings");
     if (existing == null)
     {
         return new WindowsAuthDocument();
     }
     return existing
         .DataAsJson
         .JsonDeserialization<WindowsAuthDocument>();
 }
开发者ID:cdnico,项目名称:docs.particular.net,代码行数:11,代码来源:UserCreation.cs

示例2: AfterExecute

        internal static void AfterExecute(IDatabaseCommands databaseCommands, string indexName, ScriptedIndexResults scripts)
        {
            var documentId = GetScriptedIndexResultsDocumentId(indexName);
            scripts.Id = documentId;

            var oldDocument = databaseCommands.Get(documentId);
            var newDocument = RavenJObject.FromObject(scripts);
            if (oldDocument != null && RavenJToken.DeepEquals(oldDocument.DataAsJson, newDocument))
                return;

            databaseCommands.Put(documentId, null, newDocument, null);
            databaseCommands.ResetIndex(indexName);
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:13,代码来源:AbstractScriptedIndexCreationTask.cs

示例3: WaitForDocument

        protected virtual void WaitForDocument(IDatabaseCommands databaseCommands, string id)
        {
            var done = SpinWait.SpinUntil(() =>
            {
                // We expect to get the doc from the <system> database
                var doc = databaseCommands.Get(id);
                return doc != null;
            }, TimeSpan.FromMinutes(5));

            if (!done) throw new Exception("WaitForDocument failed");
        }
开发者ID:hero106wen,项目名称:ravendb,代码行数:11,代码来源:RavenTestBase.cs

示例4: GetNextRange

		private RangeValue GetNextRange(IDatabaseCommands databaseCommands)
		{
#if !NETFX_CORE
			using (new TransactionScope(TransactionScopeOption.Suppress))
			{
#endif
				ModifyCapacityIfRequired();
				while (true)
				{
					try
					{
						var minNextMax = Range.Max;
						JsonDocument document;

						try
						{
							document = GetDocument(databaseCommands);
						}
						catch (ConflictException e)
						{
							// resolving the conflict by selecting the highest number
							var highestMax = e.ConflictedVersionIds
								.Select(conflictedVersionId => GetMaxFromDocument(databaseCommands.Get(conflictedVersionId), minNextMax))
								.Max();

							PutDocument(databaseCommands, new JsonDocument
							{
								Etag = e.Etag,
								Metadata = new RavenJObject(),
								DataAsJson = RavenJObject.FromObject(new { Max = highestMax }),
								Key = HiLoDocumentKey
							});

							continue;
						}

						long min, max;
						if (document == null)
						{
							min = minNextMax + 1;
							max = minNextMax + capacity;
							document = new JsonDocument
							{
								Etag = Etag.Empty,
								// sending empty etag means - ensure the that the document does NOT exists
								Metadata = new RavenJObject(),
								DataAsJson = RavenJObject.FromObject(new { Max = max }),
								Key = HiLoDocumentKey
							};
						}
						else
						{
							var oldMax = GetMaxFromDocument(document, minNextMax);
							min = oldMax + 1;
							max = oldMax + capacity;

							document.DataAsJson["Max"] = max;
						}
						PutDocument(databaseCommands, document);

						return new RangeValue(min, max);
					}
					catch (ConcurrencyException)
					{
						// expected, we need to retry
					}
				}
#if !NETFX_CORE
			}
#endif
		}
开发者ID:samueldjack,项目名称:ravendb,代码行数:71,代码来源:HiLoKeyGenerator.cs

示例5: GetDocument

		private JsonDocument GetDocument(IDatabaseCommands databaseCommands)
		{
			var documents = databaseCommands.Get(new[] { HiLoDocumentKey, RavenKeyServerPrefix }, new string[0]);
			return HandleGetDocumentResult(documents);
		}
开发者ID:samueldjack,项目名称:ravendb,代码行数:5,代码来源:HiLoKeyGenerator.cs

示例6: WaitForDocument

		protected void WaitForDocument(IDatabaseCommands databaseCommands, string id)
		{
			var done = SpinWait.SpinUntil(() =>
			{
				// We expect to get the doc from the <system> database
				var doc = databaseCommands.Get(id);
				return doc != null;
			}, TimeSpan.FromMinutes(5));

			Assert.True(done);
		}
开发者ID:Nakro,项目名称:ravendb,代码行数:11,代码来源:RavenTestBase.cs

示例7: WaitForRestore

		protected void WaitForRestore(IDatabaseCommands databaseCommands)
		{
			var done = SpinWait.SpinUntil(() =>
			{
				// We expect to get the doc from the <system> database
				var doc = databaseCommands.Get(RestoreStatus.RavenRestoreStatusDocumentKey);

				if (doc == null)
					return false;

				var status = doc.DataAsJson["restoreStatus"].Values().Select(token => token.ToString()).ToList();

				var restoreFinishMessages = new[]
				{
					"The new database was created",
					"Esent Restore: Restore Complete", 
					"Restore ended but could not create the datebase document, in order to access the data create a database with the appropriate name",
				};
				return restoreFinishMessages.Any(status.Last().Contains);
			}, TimeSpan.FromMinutes(5));

			Assert.True(done);
		}
开发者ID:Nakro,项目名称:ravendb,代码行数:23,代码来源:RavenTestBase.cs


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