本文整理汇总了C#中System.Guid.TransformToValueForEsentSorting方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.TransformToValueForEsentSorting方法的具体用法?C# Guid.TransformToValueForEsentSorting怎么用?C# Guid.TransformToValueForEsentSorting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.TransformToValueForEsentSorting方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public IEnumerable<ListItem> Read(string name, Guid start, 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;
count++;
var etag = Api.RetrieveColumn(session, Lists, tableColumnsCache.ListsColumns["etag"]).TransfromToGuidWithProperSorting();
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);
}
示例2: RemoveAllBefore
public void RemoveAllBefore(string name, Guid 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.InvariantCultureIgnoreCase) == false)
break;
Api.JetDelete(session, Lists);
} while (Api.TryMovePrevious(session, Lists));
}
示例3: GetAttachmentsAfter
public IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid etag)
{
Api.JetSetCurrentIndex(session, Files, "by_etag");
Api.MakeKey(session, Files, etag.TransformToValueForEsentSorting(), MakeKeyGrbit.NewKey);
if (Api.TrySeek(session, Files, SeekGrbit.SeekGT) == false)
yield break;
do
{
yield return new AttachmentInformation
{
Size = Api.RetrieveColumnSize(session, Files, tableColumnsCache.FilesColumns["data"]).Value,
Etag = Api.RetrieveColumn(session, Files, tableColumnsCache.FilesColumns["etag"]).TransfromToGuidWithProperSorting(),
Key = Api.RetrieveColumnAsString(session, Files, tableColumnsCache.FilesColumns["name"], Encoding.UTF8),
Metadata = JObject.Parse(Api.RetrieveColumnAsString(session, Files, tableColumnsCache.FilesColumns["metadata"], Encoding.Unicode))
};
} while (Api.TryMoveNext(session, Files));
}
示例4: UpdateLastIndexed
public void UpdateLastIndexed(string index, Guid etag, DateTime timestamp)
{
SetCurrentIndexStatsTo(index);
using(var update = new Update(session, IndexesStats, JET_prep.Replace))
{
Api.SetColumn(session, IndexesStats,
tableColumnsCache.IndexesStatsColumns["last_indexed_etag"],
etag.TransformToValueForEsentSorting());
Api.SetColumn(session, IndexesStats,
tableColumnsCache.IndexesStatsColumns["last_indexed_timestamp"],
timestamp);
update.Save();
}
}
示例5: GetFilesAfter
public IEnumerable<FileHeader> GetFilesAfter(Guid 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
{
Name =
Api.RetrieveColumnAsString(session, Files, tableColumnsCache.FilesColumns["name"], Encoding.Unicode),
TotalSize = GetTotalSize(),
UploadedSize =
BitConverter.ToInt64(
Api.RetrieveColumn(session, Files, tableColumnsCache.FilesColumns["uploaded_size"]), 0),
Metadata = RetrieveMetadata()
});
} while (++index < take && Api.TryMoveNext(session, Files));
return result;
}
示例6: GetAttachmentsAfter
public IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid 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<AttachmentInformation>();
var optimizer = new OptimizedIndexReader(Session, Files, take);
do
{
optimizer.Add();
} while (Api.TryMoveNext(session, Files) && optimizer.Count < take);
return optimizer.Select(() => new AttachmentInformation
{
Size = Api.RetrieveColumnSize(session, Files, tableColumnsCache.FilesColumns["data"]) ?? 0,
Etag = Api.RetrieveColumn(session, Files, tableColumnsCache.FilesColumns["etag"]).TransfromToGuidWithProperSorting(),
Key = Api.RetrieveColumnAsString(session, Files, tableColumnsCache.FilesColumns["name"], Encoding.Unicode),
Metadata = RavenJObject.Parse(Api.RetrieveColumnAsString(session, Files, tableColumnsCache.FilesColumns["metadata"], Encoding.Unicode))
});
}
示例7: GetAttachmentsAfter
public IEnumerable<AttachmentInformation> GetAttachmentsAfter(Guid 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(Session, Files, take);
do
{
optimizer.Add();
} while (Api.TryMoveNext(session, Files) && optimizer.Count < take);
long totalSize = 0;
return optimizer
.Where(_ => totalSize <= maxTotalSize)
.Select(o => ReadCurrentAttachmentInformation())
.Select(x=>
{
totalSize += x.Size;
return x;
});
}
示例8: UpdateLastReduced
public void UpdateLastReduced(string index, Guid etag, DateTime timestamp)
{
Api.JetSetCurrentIndex(session, IndexesStatsReduce, "by_key");
Api.MakeKey(session, IndexesStatsReduce, index, Encoding.Unicode, MakeKeyGrbit.NewKey);
if (Api.TrySeek(session, IndexesStatsReduce, SeekGrbit.SeekEQ) == false)
throw new IndexDoesNotExistsException("There is no reduce index named: " + index);
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();
}
}
示例9: GetDocumentsAfter
public IEnumerable<JsonDocument> GetDocumentsAfter(Guid etag)
{
Api.JetSetCurrentIndex(session, Documents, "by_etag");
Api.MakeKey(session, Documents, etag.TransformToValueForEsentSorting(), MakeKeyGrbit.NewKey);
if(Api.TrySeek(session, Documents, SeekGrbit.SeekGT)==false)
yield break;
do
{
var data = Api.RetrieveColumn(session, Documents, tableColumnsCache.DocumentsColumns["data"]);
var key = Api.RetrieveColumnAsString(session, Documents, tableColumnsCache.DocumentsColumns["key"],Encoding.Unicode);
var metadata = Api.RetrieveColumn(session, Documents, tableColumnsCache.DocumentsColumns["metadata"]).ToJObject();
data = documentCodecs.Aggregate(data, (bytes, codec) => codec.Decode(key, metadata, bytes));
yield return new JsonDocument
{
Key = key,
DataAsJson = data.ToJObject(),
NonAuthoritiveInformation = IsDocumentModifiedInsideTransaction(key),
LastModified = Api.RetrieveColumnAsDateTime(session, Documents, tableColumnsCache.DocumentsColumns["last_modified"]).Value,
Etag = Api.RetrieveColumn(session, Documents, tableColumnsCache.DocumentsColumns["etag"]).TransfromToGuidWithProperSorting(),
Metadata = metadata
};
} while (Api.TryMoveNext(session, Documents));
}