Exemplo n.º 1
0
 public EfRepository(IRepositoryContext context)
     : base(context)
 {
     if (context is IEfRepositoryContext)
     {
         efContext = context as IEfRepositoryContext;
         db        = efContext.DbContext;
     }
 }
Exemplo n.º 2
0
        public EfRepository(IRepositoryContext context)
            : base(context)
        {
            if (context is IEfRepositoryContext)
            {
                this.efContext = context as IEfRepositoryContext;
                this.db        = efContext.DbContext;
            }

            var incremental = new Incremental(5, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(1.5))
            {
                FastFirstRetry = true
            };

            this.RetryPolicy = new RetryPolicy <SqlDatabaseTransientErrorDetectionStrategy>(incremental);

            this.RetryPolicy.Retrying += (s, e) =>
                                         Trace.TraceWarning("An error occurred in attempt number {1} to access the database in ConferenceService: {0}",
                                                            e.LastException.Message, e.CurrentRetryCount);
        }