示例#1
0
 public Transaction(IDBTraits traits, string connectionString)
 {
     this.traits = traits;
     DbConnection _connection = null;
     DbTransaction _transaction = null;
     try
     {
         _connection = traits.CreateConnection(connectionString);
         _transaction = _connection.BeginTransaction(IsolationLevel.Serializable);
         this.connection = _connection;
         this.transaction = _transaction;
     } catch(Exception)
     {
         if(_transaction != null)
         {
             _transaction.Dispose();
             this.transaction = null;
         }
         if(_connection != null)
         {
             _connection.Dispose();
             this.connection = null;
         }
         throw;
     }
 }
示例#2
0
        public Transaction(IDBTraits traits, string connectionString)
        {
            this.traits = traits;
            DbConnection  _connection  = null;
            DbTransaction _transaction = null;

            try
            {
                _connection      = traits.CreateConnection(connectionString);
                _transaction     = _connection.BeginTransaction(IsolationLevel.Serializable);
                this.connection  = _connection;
                this.transaction = _transaction;
            } catch (Exception)
            {
                if (_transaction != null)
                {
                    _transaction.Dispose();
                    this.transaction = null;
                }
                if (_connection != null)
                {
                    _connection.Dispose();
                    this.connection = null;
                }
                throw;
            }
        }
示例#3
0
 public Connection(string connectionString, IDBTraits traits, ILogger logger)
 {
     this.traits = traits;
     this.logger = logger;
     this.connectionString = connectionString;
     using(DbConnection connection = this.createConnection()) {
         //just testing we can open a connection
     }
     this.transactions = new HashSet<Transaction>();
 }
示例#4
0
 public Connection(string connectionString, IDBTraits traits, ILogger logger)
 {
     this.traits           = traits;
     this.logger           = logger;
     this.connectionString = connectionString;
     using (DbConnection connection = this.createConnection()) {
         //just testing we can open a connection
     }
     this.transactions = new HashSet <Transaction>();
 }
示例#5
0
 public static KeyValuePair<string, ParamsHolder> Compile(AbstractCondition condition, IDBTraits traits)
 {
     ConditionCompiler compiler = new ConditionCompiler(traits);
     string compiled = compiler.CompileCondition(condition);
     return new KeyValuePair<string,ParamsHolder>(compiled, compiler.paramsholder);
 }
示例#6
0
 private ConditionCompiler(IDBTraits traits)
 {
     this.paramsholder = new ParamsHolder();
     this.traits = traits;
 }
示例#7
0
        public static KeyValuePair <string, ParamsHolder> Compile(AbstractCondition condition, IDBTraits traits)
        {
            ConditionCompiler compiler = new ConditionCompiler(traits);
            string            compiled = compiler.CompileCondition(condition);

            return(new KeyValuePair <string, ParamsHolder>(compiled, compiler.paramsholder));
        }
示例#8
0
 private ConditionCompiler(IDBTraits traits)
 {
     this.paramsholder = new ParamsHolder();
     this.traits       = traits;
 }
示例#9
0
 public static string compile(this ITableSpec table, IDBTraits traits)
 {
     return(traits.escapeIdentifier(table.name));
 }
示例#10
0
 public static string compile(this ColumnSpec column, IDBTraits traits)
 {
     return(column.table.compile(traits) + "." + traits.escapeIdentifier(column.name));
 }
示例#11
0
 public static string compile(this ColumnSpec column, IDBTraits traits)
 {
     return column.table.compile(traits) + "." + traits.escapeIdentifier(column.name);
 }
示例#12
0
 public static string compile(this ITableSpec table, IDBTraits traits)
 {
     return traits.escapeIdentifier(table.name);
 }
示例#13
0
 public Context(IUpdateParams updateParams, IInteractiveConsole console)
 {
     this.updateParams = updateParams;
     this.DbDriver     = DBTraitsFactory.GetTraits(updateParams.DbDriverName);
     this.console      = console;
 }
示例#14
0
 public Context(IUpdateParams updateParams, IInteractiveConsole console)
 {
     this.updateParams = updateParams;
     this.DbDriver = DBTraitsFactory.GetTraits(updateParams.DbDriverName);
     this.console = console;
 }