IoReporterContext
Represents a thread-safe context for IIoReporter to publish events. This class cannot be inherited.
using System;
namespace Relativity.DataExchange.Io
{
public sealed class IoReporterContext
{
public IAppSettings AppSettings { get; set; }
public IFileSystem FileSystem { get; set; }
public RetryOptions RetryOptions { get; set; }
public IWaitAndRetryPolicy WaitAndRetryPolicy { get; set; }
public event EventHandler<IoWarningEventArgs> IoWarningEvent;
public IoReporterContext()
: this(Relativity.DataExchange.Io.FileSystem.Instance.DeepCopy(), Relativity.DataExchange.AppSettings.Instance, new WaitAndRetryPolicy())
{
}
public IoReporterContext(IFileSystem fileSystem, IAppSettings settings, IWaitAndRetryPolicy waitAndRetryPolicy)
{
if (fileSystem == null)
throw new ArgumentNullException("fileSystem");
if (settings == null)
throw new ArgumentNullException("settings");
if (waitAndRetryPolicy == null)
throw new ArgumentNullException("waitAndRetryPolicy");
FileSystem = fileSystem;
AppSettings = settings;
WaitAndRetryPolicy = waitAndRetryPolicy;
RetryOptions = settings.RetryOptions;
}
public void PublishIoWarningEvent(IoWarningEventArgs eventArgs)
{
this.IoWarningEvent?.Invoke(this, eventArgs);
}
}
}