Esempio n. 1
0
 public AlphaRepository(
     IDbContextSession <PrimaryContext> session,
     IContextSettingsCacheService contextSettingsCacheService,
     IBulkInserterFactory bulkInserterFactory,
     ITableMappingCacheService tableMappingsCacheService)
     : base(session, contextSettingsCacheService, bulkInserterFactory, tableMappingsCacheService)
 {
 }
Esempio n. 2
0
 public PrimaryRepository(
     IDbContextSession <PrimaryContext> session,
     ITimeoutCacheService timeoutCacheService,
     IBulkInserterFactory bulkInserterFactory,
     ITableMappingsCacheService tableMappingsCacheService)
     : base(session, timeoutCacheService, bulkInserterFactory, tableMappingsCacheService)
 {
 }
Esempio n. 3
0
 protected BulkEnabledRepository(
     IDbContextSession <TContext> session,
     ITimeoutCacheService timeoutCacheService,
     ITableMappingsCacheService tableMappingsCacheService)
     : base(session)
 {
     this.tableMappingsCacheService = tableMappingsCacheService;
     this.timeoutCacheService       = timeoutCacheService;
     this.session = session;
 }
Esempio n. 4
0
 protected BulkInsertRepository(
     IDbContextSession <TContext> session,
     IContextSettingsCacheService contextSettingsCacheService,
     IBulkInserterFactory bulkInserterFactory,
     ITableMappingCacheService tableMappingCacheService)
     : base(session, contextSettingsCacheService, tableMappingCacheService)
 {
     this.contextSettingsCacheService = contextSettingsCacheService;
     this.bulkInserterFactory         = bulkInserterFactory;
     this.session = session;
 }
Esempio n. 5
0
        private TReturn PerformWork <TReturn>(Func <TReturn> unitOfWork, IDbContextSession <TContext> contextSession)
        {
            TReturn returnValue;

            if (contextSession.HasCurrentTransaction())
            {
                returnValue = unitOfWork();
                contextSession.CommitChanges();
            }
            else
            {
                using (var transaction = contextSession.StartNewTransaction())
                {
                    try
                    {
                        returnValue = unitOfWork();
                        contextSession.CommitChanges();
                        transaction.Commit();
                    }
                    catch
                    {
                        try
                        {
                            transaction.Rollback();
                        }
                        catch
                        {
                            //swallow
                        }

                        try
                        {
                            contextSession.RevertChanges();
                        }
                        catch
                        {
                            // swallow;
                        }

                        // throw original
                        throw;
                    }
                }
            }

            return(returnValue);
        }
Esempio n. 6
0
        private void PerformWork(Action unitOfWork, IDbContextSession <TContext> contextSession)
        {
            if (contextSession.HasCurrentTransaction())
            {
                unitOfWork();
                contextSession.CommitChanges();
            }
            else
            {
                using (var transaction = contextSession.StartNewTransaction())
                {
                    try
                    {
                        unitOfWork();
                        contextSession.CommitChanges();
                        transaction.Commit();
                    }
                    catch
                    {
                        try
                        {
                            transaction.Rollback();
                        }
                        catch
                        {
                            //swallow
                        }

                        try
                        {
                            contextSession.RevertChanges();
                        }
                        catch
                        {
                            // swallow;
                        }

                        // throw original
                        throw;
                    }
                }
            }
        }
Esempio n. 7
0
 protected SimpleGenericRepository(
     IDbContextSession <TContext> session)
     : base(session)
 {
 }
Esempio n. 8
0
 public Repository(IDbContextSession <TContext> session)
 {
     this.session = session;
 }
 public SimplePrimaryRepository(
     IDbContextSession <PrimaryContext> session)
     : base(session)
 {
 }
Esempio n. 10
0
 public TReturn PerformUnitOfWork <TReturn>(Func <TReturn> unitOfWork, IDbContextSession <TContext> contextSession)
 {
     return(this.PerformWork(unitOfWork, contextSession));
 }
Esempio n. 11
0
 public void PerformUnitOfWork(Action unitOfWork, IDbContextSession <TContext> contextSession)
 {
     this.PerformWork(unitOfWork, contextSession);
 }
Esempio n. 12
0
 public GenericTransactionService(IDbContextSession <TContext> session)
 {
     this.session = session;
 }