private void InvokePartitionCollection(IErrorReporterContext context)
        {
            var ctx2 = context as IErrorReporterContext2;

            if (ctx2 == null)
            {
                return;
            }

            var col = new ErrPartitionContextCollection();

            ctx2.ContextCollections.Add(col);
            var partitionContext = new PartitionContext(col, ctx2);

            foreach (var callback in _configuration.PartitionCallbacks)
            {
                try
                {
                    callback(partitionContext);
                }
                catch (Exception ex)
                {
                    col.Properties.Add("PartitionCollection.Err", $"Callback {callback} failed: {ex}");
                }
            }
        }
Example #2
0
 /// <summary>
 ///     Creates a new instance of <see cref="PartitionContext" />.
 /// </summary>
 /// <param name="contextCollection">context to add partitions to.</param>
 /// <param name="reporterContext">
 ///     Context used when collecting all other context data (before partition collection is
 ///     invoked)
 /// </param>
 public PartitionContext(ErrPartitionContextCollection contextCollection, IErrorReporterContext2 reporterContext)
 {
     _contextCollection = contextCollection ?? throw new ArgumentNullException(nameof(contextCollection));
     ReporterContext    = reporterContext;
 }