public PolicyRepository( AppliedSystemsContext context, IAppSettings appSettings, ISqlExceptionRetryPolicy sqlExceptionRetryPolicy) : base(context, appSettings, sqlExceptionRetryPolicy) { }
public AppliedSystemsRepository( AppliedSystemsContext context, IAppSettings appSettings, ISqlExceptionRetryPolicy sqlExceptionRetryPolicy) { if (context == null) { throw new ArgumentNullException("context"); } if (appSettings == null) { throw new ArgumentNullException("appSettings"); } if (sqlExceptionRetryPolicy == null) { throw new ArgumentNullException("sqlExceptionRetryPolicy"); } AppSettings = appSettings; Context = context; Context.Database.CommandTimeout = 120; RetryPolicy = Policy .Handle <SqlException>(sqlExceptionRetryPolicy.IsTransientException) .Retry(appSettings.SqlExceptionRetryCount, (exception, retryCount) => { // TODO: Log the exception and saywe are retrying - event log? }); AsyncRetryPolicy = Policy .Handle <SqlException>(sqlExceptionRetryPolicy.IsTransientException) .RetryAsync(appSettings.SqlExceptionRetryCount, (exception, retryCount) => { // TODO: Log the exception and say we are retrying - event log? }); }