本文整理汇总了C#中XPCollection.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# XPCollection.OrderBy方法的具体用法?C# XPCollection.OrderBy怎么用?C# XPCollection.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPCollection
的用法示例。
在下文中一共展示了XPCollection.OrderBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadProtocolPackage
/// <summary>
/// Loads the package.
/// </summary>
/// <param name="context">The context.</param>
/// <returns></returns>
public string LoadProtocolPackage(LoadPackageContext context)
{
var result = string.Empty;
try
{
using (var uow = context.Package.UnitOfWork)
{
var topSessions = new XPCollection<PackageSession>(uow, CriteriaOperator.Parse("IsNull(Parent)"));
var senderNode = ReplicationNode.FindNode(context.ObjectSpace, context.Package.SenderNodeId);
topSessions.OrderBy(x => x.CommitedOn.Add(x.UtcOffset))
/* skip sessions commited before last loaded snapshot */
.Where(x => senderNode == null || x.CommitedOn > senderNode.InitDateTime)
.TakeWhile(z => !context.Worker.CancellationPending).ToList()
.ForEach(y => loadTopSession(new LoadPackageSessionContext(context, y)));
context.ObjectSpace.CommitChanges();
}
}
catch (Exception exception)
{
result = string.Format(Localizer.PackageLoadError, exception.Message);
context.Worker.ReportError( result);
}
if (string.IsNullOrEmpty(result))
{
if (context.Worker.CancellationPending)
result = Localizer.LoadingAborted;
context.Worker.ReportProgress(Color.Blue, Localizer.LoadingIs,
(context.Worker.CancellationPending ? Localizer.Aborted
: Localizer.Finished));
}
return result;
}