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


C# Etag.TransformToValueForEsentSorting方法代码示例

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


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

示例1: Read

		public IEnumerable<ListItem> Read(string name, Etag start, Etag end, int take)
		{
			Api.JetSetCurrentIndex(session, Lists, "by_name_and_etag");
			Api.MakeKey(session, Lists, name, Encoding.Unicode, MakeKeyGrbit.NewKey);
			Api.MakeKey(session, Lists, start.TransformToValueForEsentSorting(), MakeKeyGrbit.None);
			if (Api.TrySeek(session, Lists, SeekGrbit.SeekGT) == false)
				yield break;
		
			int count = 0;
			do
			{
				var nameFromDb = Api.RetrieveColumnAsString(session, Lists, tableColumnsCache.ListsColumns["name"], Encoding.Unicode);
				if (string.Equals(name, nameFromDb, StringComparison.InvariantCultureIgnoreCase) == false)
					yield break;


				var etag = Etag.Parse(Api.RetrieveColumn(session, Lists, tableColumnsCache.ListsColumns["etag"]));
				if (end != null && end.CompareTo(etag) <= 0)
					yield break;

				count++;
				
				using (Stream stream = new BufferedStream(new ColumnStream(session, Lists, tableColumnsCache.ListsColumns["data"])))
				{
					yield return new ListItem
					{
						Etag = etag,
						Data = stream.ToJObject(),
						Key = Api.RetrieveColumnAsString(session, Lists, tableColumnsCache.ListsColumns["key"], Encoding.Unicode)
					};
				}
			} while (Api.TryMoveNext(session, Lists) && count < take);

		}
开发者ID:cocytus,项目名称:ravendb,代码行数:34,代码来源:Lists.cs

示例2: RemoveAllBefore

		public void RemoveAllBefore(string name, Etag etag)
		{
			Api.JetSetCurrentIndex(session, Lists, "by_name_and_etag");
			Api.MakeKey(session, Lists, name, Encoding.Unicode, MakeKeyGrbit.NewKey);
			Api.MakeKey(session, Lists, etag.TransformToValueForEsentSorting(), MakeKeyGrbit.None);
			if (Api.TrySeek(session, Lists, SeekGrbit.SeekLE) == false)
				return;
			do
			{
				var nameFromDb = Api.RetrieveColumnAsString(session, Lists, tableColumnsCache.ListsColumns["name"], Encoding.Unicode);
				if (string.Equals(name, nameFromDb, StringComparison.OrdinalIgnoreCase) == false)
					break;

				Api.JetDelete(session, Lists);

			} while (Api.TryMovePrevious(session, Lists));

		}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:18,代码来源:Lists.cs

示例3: UpdateLastReduced

		public void UpdateLastReduced(int id, Etag etag, DateTime timestamp)
		{
			Api.JetSetCurrentIndex(session, IndexesStatsReduce, "by_key");
			Api.MakeKey(session, IndexesStatsReduce, id, MakeKeyGrbit.NewKey);
			if (Api.TrySeek(session, IndexesStatsReduce, SeekGrbit.SeekEQ) == false)
				throw new IndexDoesNotExistsException("There is no reduce index named: " + id.ToString());

			using (var update = new Update(session, IndexesStatsReduce, JET_prep.Replace))
			{
				Api.SetColumn(session, IndexesStatsReduce,tableColumnsCache.IndexesStatsReduceColumns["last_reduced_etag"],etag.TransformToValueForEsentSorting());
				Api.SetColumn(session, IndexesStatsReduce,
							  tableColumnsCache.IndexesStatsReduceColumns["last_reduced_timestamp"],
							  timestamp.ToBinary());
				update.Save();
			}
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:16,代码来源:Indexing.cs

示例4: GetFilesAfter

		public IEnumerable<FileHeader> GetFilesAfter(Etag etag, int take)
		{
            Api.JetSetCurrentIndex(session, Files, "by_etag");
			Api.MakeKey(session, Files, etag.TransformToValueForEsentSorting(), MakeKeyGrbit.NewKey);
            if (Api.TrySeek(session, Files, SeekGrbit.SeekGT) == false)
                return Enumerable.Empty<FileHeader>();

            var result = new List<FileHeader>();
			var index = 0;

			do
			{
                result.Add(new FileHeader (Api.RetrieveColumnAsString(session, Files, tableColumnsCache.FilesColumns["name"], Encoding.Unicode), RetrieveMetadata() )
					           {
						           TotalSize = GetTotalSize(),
						           UploadedSize = BitConverter.ToInt64( Api.RetrieveColumn(session, Files, tableColumnsCache.FilesColumns["uploaded_size"]), 0),
					           });
			} while (++index < take && Api.TryMoveNext(session, Files));

			return result;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:21,代码来源:StorageActionsAccessor.cs

示例5: Touch

        public void Touch(string name, string key, UuidType uuidType, out Etag preTouchEtag, out Etag afterTouchEtag)
        {
            Api.JetSetCurrentIndex(session, Lists, "by_name_and_key");
            Api.MakeKey(session, Lists, name, Encoding.Unicode, MakeKeyGrbit.NewKey);
            Api.MakeKey(session, Lists, key, Encoding.Unicode, MakeKeyGrbit.None);

            if (Api.TrySeek(session, Lists, SeekGrbit.SeekEQ) == false)
            {
                afterTouchEtag = null;
                preTouchEtag = null;
                return;
            }

            preTouchEtag = Etag.Parse(Api.RetrieveColumn(session, Lists, tableColumnsCache.ListsColumns["etag"]));

            using (var update = new Update(session, Lists, JET_prep.Replace))
            {
                afterTouchEtag = uuidGenerator.CreateSequentialUuid(uuidType);
                Api.SetColumn(session, Lists, tableColumnsCache.ListsColumns["etag"], afterTouchEtag.TransformToValueForEsentSorting());
                update.Save();
            }
        }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:22,代码来源:Lists.cs

示例6: GetAttachmentsAfter

		public IEnumerable<AttachmentInformation> GetAttachmentsAfter(Etag etag, int take, long maxTotalSize)
		{
			Api.JetSetCurrentIndex(session, Files, "by_etag");
			Api.MakeKey(session, Files, etag.TransformToValueForEsentSorting(), MakeKeyGrbit.NewKey);
			if (Api.TrySeek(session, Files, SeekGrbit.SeekGT) == false)
				return Enumerable.Empty<AttachmentInformation>();

			var optimizer = new OptimizedIndexReader();
			do
			{
				optimizer.Add(Session, Files);
			} while (Api.TryMoveNext(session, Files) && optimizer.Count < take);

			long totalSize = 0;

			return optimizer
				.Where(_ => totalSize <= maxTotalSize)
				.Select(Session, Files, o => ReadCurrentAttachmentInformation())
				.Select(x =>
				{
					totalSize += x.Size;
					return x;
				});
		}
开发者ID:925coder,项目名称:ravendb,代码行数:24,代码来源:DocumentStorageActions.cs


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