示例#1
0
        protected DbSession(IDbDatabase database)
        {
            _database = database as DbDatabase;
            if (_database == null)
            {
                throw new XException($"A classe {GetType().Name} não tem suporte a Database do tipo {database.GetType().Name}");
            }

            _accessInTransaction = new Dictionary <IDbAccess, DbContext>();
        }
示例#2
0
        public bool Storage(IDbDatabase database)
        {
            if (Constains(database.Name))
            {
                return(false);
            }

            _dbs.Add(database.Name, database);

            return(true);
        }
示例#3
0
        public static bool RetryInteraction(IDbDatabase database, SqlException exception)
        {
            switch (exception.Number)
            {
            case TimeoutErrorCode:
            case -2:
                return((database.Options & EDatabaseOption.RetryTimeout) == EDatabaseOption.RetryTimeout);

            case DeadlockErrorCode:
                return((database.Options & EDatabaseOption.RetryDeadlock) == EDatabaseOption.RetryDeadlock);

            case TransportLevelErrorCode when exception.Class == TransportLevelSeverityClass:
                SqlConnection.ClearAllPools();

                return(true);

            default:
                return(false);
            }
        }
示例#4
0
 public SqlServerSession(IDbDatabase dbServerDatabase) : base(dbServerDatabase)
 {
 }