本文整理汇总了C#中Raven.Abstractions.Data.JsonDocument.Select方法的典型用法代码示例。如果您正苦于以下问题:C# JsonDocument.Select方法的具体用法?C# JsonDocument.Select怎么用?C# JsonDocument.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Raven.Abstractions.Data.JsonDocument
的用法示例。
在下文中一共展示了JsonDocument.Select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryResolveConflict
public bool TryResolveConflict(string key, JsonDocument[] conflictedDocs, out JsonDocument resolvedDocument)
{
resolvedDocument = new JsonDocument
{
DataAsJson = new RavenJObject
{
{"Name", string.Join(" ", conflictedDocs.Select(x => x.DataAsJson.Value<string>("Name")).OrderBy(x=>x))}
},
Metadata = new RavenJObject()
};
return true;
}
示例2: IndexDocuments
private void IndexDocuments(IStorageActionsAccessor actions, string index, JsonDocument[] jsonDocs)
{
var viewGenerator = context.IndexDefinitionStorage.GetViewGenerator(index);
if (viewGenerator == null)
return; // index was deleted, probably
var dateTime = jsonDocs.Min(x => x.LastModified) ?? DateTime.MinValue;
var documentRetriever = new DocumentRetriever(null, context.ReadTriggers);
try
{
log.DebugFormat("Indexing {0} documents for index: {1}", jsonDocs.Length, index);
context.IndexStorage.Index(index, viewGenerator,
jsonDocs
.Select(doc => documentRetriever
.ExecuteReadTriggers(doc, null, ReadOperation.Index))
.Where(doc => doc != null)
.Select(x => JsonToExpando.Convert(x.ToJson())), context, actions, dateTime);
}
catch (Exception e)
{
if (actions.IsWriteConflict(e))
return;
log.WarnFormat(e, "Failed to index documents for index: {0}", index);
}
}