本文整理汇总了C#中IReadOnlyDictionary.SelectMany方法的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyDictionary.SelectMany方法的具体用法?C# IReadOnlyDictionary.SelectMany怎么用?C# IReadOnlyDictionary.SelectMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReadOnlyDictionary
的用法示例。
在下文中一共展示了IReadOnlyDictionary.SelectMany方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
public IEnumerable<StageResult> Handle(IReadOnlyDictionary<Guid, List<IAggregatableMessage>> processingResultsMap)
{
try
{
var messages = processingResultsMap.SelectMany(pair => pair.Value)
.Cast<AggregatableMessage<ICommand>>()
.ToArray();
Handle(messages.SelectMany(x => x.Commands).OfType<IAggregateCommand>().ToArray());
Handle(messages.SelectMany(x => x.Commands).OfType<RecordDelayCommand>().ToArray());
return processingResultsMap.Keys.Select(bucketId => MessageProcessingStage.Handling.ResultFor(bucketId).AsSucceeded());
}
catch (Exception ex)
{
_tracer.Error(ex, "Error when calculating statistics");
return processingResultsMap.Keys.Select(bucketId => MessageProcessingStage.Handling.ResultFor(bucketId).AsFailed().WithExceptions(ex));
}
}
开发者ID:2gis,项目名称:nuclear-river-customer-intelligence,代码行数:19,代码来源:ProjectStatisticsAggregateCommandsHandler.cs
示例2: Handle
public IEnumerable<StageResult> Handle(IReadOnlyDictionary<Guid, List<IAggregatableMessage>> processingResultsMap)
{
try
{
var messages = processingResultsMap.SelectMany(pair => pair.Value)
.Cast<OperationAggregatableMessage<FactOperation>>()
.ToArray();
Handle(messages.SelectMany(message => message.Operations).ToArray());
var eldestOperationPerformTime = messages.Min(message => message.OperationTime);
_telemetryPublisher.Publish<PrimaryProcessingDelayIdentity>((long)(DateTime.UtcNow - eldestOperationPerformTime).TotalMilliseconds);
return processingResultsMap.Keys.Select(bucketId => MessageProcessingStage.Handling.ResultFor(bucketId).AsSucceeded());
}
catch (Exception ex)
{
_tracer.Error(ex, "Error when import facts for ERM");
return processingResultsMap.Keys.Select(bucketId => MessageProcessingStage.Handling.ResultFor(bucketId).AsFailed().WithExceptions(ex));
}
}