本文整理汇总了C#中IReadOnlyCollection.Min方法的典型用法代码示例。如果您正苦于以下问题:C# IReadOnlyCollection.Min方法的具体用法?C# IReadOnlyCollection.Min怎么用?C# IReadOnlyCollection.Min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReadOnlyCollection
的用法示例。
在下文中一共展示了IReadOnlyCollection.Min方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Handle
private void Handle(IReadOnlyCollection<RecordDelayCommand> commands)
{
if (!commands.Any())
{
return;
}
var eldestEventTime = commands.Min(x => x.EventTime);
var delta = DateTime.UtcNow - eldestEventTime;
_telemetryPublisher.Publish<StatisticsProcessingDelayIdentity>((long)delta.TotalMilliseconds);
}
开发者ID:2gis,项目名称:nuclear-river-customer-intelligence,代码行数:11,代码来源:ProjectStatisticsAggregateCommandsHandler.cs
示例2: Handle
private void Handle(IReadOnlyCollection<RecordDelayCommand> commands)
{
if (!commands.Any())
{
return;
}
var eldestEventTime = commands.Min(x => x.EventTime);
var delta = DateTime.UtcNow - eldestEventTime;
_eventLogger.Log(new IEvent[] { new BatchProcessedEvent(DateTime.UtcNow) });
_telemetryPublisher.Publish<PrimaryProcessingDelayIdentity>((long)delta.TotalMilliseconds);
}
示例3: Analyze
public IEnumerable<Fact> Analyze(IReadOnlyCollection<DiceRoll> statistics)
{
ICollection<Fact> facts = new Collection<Fact>();
var statisticsCount = statistics.Count(); //check for real diceroll
var successfulFact = new Fact
{
Description = "Count",
Divident = statisticsCount,
Divider = statisticsCount
};
facts.Add(successfulFact);
var sameFact = new Fact
{
Description = "Same",
Divident = statistics.Count(o => o.IsSameValue),
Divider = statisticsCount
};
facts.Add(sameFact);
var minSum = statistics.Min(o => o.Sum);
var maxSum = statistics.Max(o => o.Sum);
for (var i = minSum; i <= maxSum; i++)
{
var sumFact = new Fact
{
Description = "Sum " + i,
Divident = statistics.Count(o => o.Sum == i),
Divider = statisticsCount
};
facts.Add(sumFact);
}
//add single value fact generation
return facts;
}
示例4: CommitEventsAsync
public async Task<IReadOnlyCollection<ICommittedDomainEvent>> CommitEventsAsync(
IIdentity id,
IReadOnlyCollection<SerializedEvent> serializedEvents,
CancellationToken cancellationToken)
{
var committedDomainEvents = serializedEvents
.Select(e => new EventStoreEvent
{
AggregateSequenceNumber = e.AggregateSequenceNumber,
Metadata = e.SerializedMetadata,
AggregateId = id.Value,
Data = e.SerializedData
})
.ToList();
var expectedVersion = Math.Max(serializedEvents.Min(e => e.AggregateSequenceNumber) - 1, 0);
var eventDatas = serializedEvents
.Select(e =>
{
var guid = Guid.Parse(e.Metadata["guid"]);
var eventType = string.Format("{0}.{1}.{2}", e.Metadata[MetadataKeys.AggregateName], e.Metadata.EventName, e.Metadata.EventVersion);
var data = Encoding.UTF8.GetBytes(e.SerializedData);
var meta = Encoding.UTF8.GetBytes(e.SerializedMetadata);
return new EventData(guid, eventType, true, data, meta);
})
.ToList();
try
{
using (var transaction = await _connection.StartTransactionAsync(
id.Value,
expectedVersion == 0 ? ExpectedVersion.NoStream : expectedVersion)
.ConfigureAwait(false))
{
await transaction.WriteAsync(eventDatas).ConfigureAwait(false);
var writeResult = await transaction.CommitAsync().ConfigureAwait(false);
_log.Verbose(
"Wrote entity {0} with version {1} ({2},{3})",
id,
writeResult.NextExpectedVersion - 1,
writeResult.LogPosition.CommitPosition,
writeResult.LogPosition.PreparePosition);
}
}
catch (WrongExpectedVersionException e)
{
throw new OptimisticConcurrencyException(e.Message, e);
}
return committedDomainEvents;
}