public SqlClientDynamicQuery(BusinessEntity entity) : base(entity) { }
internal abstract DynamicQuery CreateDynamicQuery(BusinessEntity entity);
/// <summary> /// Enlist by the dOOdads architecture when a IDbCommand (SqlCommand is an IDbCommand). The command may or may not be enrolled /// in a transaction depending on whether or not BeginTransaction has been called. Each call to Enlist must be followed by a /// call to <see cref="DeEnlist"/>. /// </summary> /// <param name="cmd">Your SqlCommand, OleDbCommand, etc ...</param> /// <param name="entity">Your business entity, in C# use 'this', VB.NET use 'Me'.</param> /// <example> /// C# /// <code> /// txMgr.Enlist(cmd, this); /// cmd.ExecuteNonQuery(); /// txMgr.DeEnlist(cmd, this); /// </code> /// VB.NET /// <code> /// txMgr.Enlist(cmd, Me) /// cmd.ExecuteNonQuery() /// txMgr.DeEnlist(cmd, Me) /// </code> /// </example> public void Enlist(IDbCommand cmd, BusinessEntity entity) { if(txCount == 0 || entity._notRecommendedConnection != null) { // NotRecommendedConnections never play in dOOdad transactions cmd.Connection = CreateSqlConnection(entity); } else { string connStr = entity._config; if(entity._raw != "") connStr = entity._raw; Transaction tx = this.transactions[connStr] as Transaction; if(tx == null) { IDbConnection sqlConn = CreateSqlConnection(entity); tx = new Transaction(); tx.sqlConnection = sqlConn; if(_isolationLevel != IsolationLevel.Unspecified) { tx.sqlTx = sqlConn.BeginTransaction(_isolationLevel); } else { tx.sqlTx = sqlConn.BeginTransaction(); } this.transactions[connStr] = tx; } cmd.Connection = tx.sqlConnection; cmd.Transaction = tx.sqlTx; } }
internal override DynamicQuery CreateDynamicQuery(BusinessEntity entity) { return new PostgreSqlDynamicQuery(entity); }
public OleDbDynamicQuery(BusinessEntity entity) : base(entity) { }
public AggregateClause(BusinessEntity entity) { this._entity = entity; }
override internal DynamicQuery CreateDynamicQuery(BusinessEntity entity) { return new OracleClientDynamicQuery(entity); }
internal override DynamicQuery CreateDynamicQuery(BusinessEntity entity) { return new SQLiteDynamicQuery(entity); }
override internal DynamicQuery CreateDynamicQuery(BusinessEntity entity) { return new VistaDBDynamicQuery(entity); }
public OracleClientDynamicQuery(BusinessEntity entity) : base(entity) { }
private IDbConnection CreateSqlConnection(BusinessEntity entity) { IDbConnection cn; if(entity._notRecommendedConnection != null) { // This is assumed to be open cn = entity._notRecommendedConnection; } else { cn = entity.CreateIDbConnection(); if(entity._raw != "") cn.ConnectionString = entity._raw; else #if(VS2005) cn.ConnectionString = ConfigurationManager.AppSettings[entity._config]; #else cn.ConnectionString = ConfigurationSettings.AppSettings[entity._config]; #endif cn.Open(); } return cn; }
/// <summary> /// Called internally by BusinessEntity /// </summary> /// <param name="entity"></param> internal void AddBusinessEntity(BusinessEntity entity) { if(this.objectsInTransaction == null) { this.objectsInTransaction = new ArrayList(); } this.objectsInTransaction.Add(entity); }
/// <summary> /// Each call to Enlist must be followed eventually by a call to DeEnlist. /// </summary> /// <param name="cmd"></param> /// <param name="entity"></param> /// <example> /// C# /// <code> /// txMgr.Enlist(cmd, this); /// cmd.ExecuteNonQuery(); /// txMgr.DeEnlist(cmd, this); /// </code> /// VB.NET /// <code>> /// txMgr.Enlist(cmd, Me) /// cmd.ExecuteNonQuery() /// txMgr.DeEnlist(cmd, Me) /// </code> /// </example> public void DeEnlist(IDbCommand cmd, BusinessEntity entity) { if(entity._notRecommendedConnection != null) { // NotRecommendedConnection never play in dOOdad transactions cmd.Connection = null; } else { if(txCount == 0) { cmd.Connection.Dispose(); } } }
public VisualFoxProDynamicQuery(BusinessEntity entity) : base(entity) { }
internal override DynamicQuery CreateDynamicQuery(BusinessEntity entity) { return new FirebirdSqlDynamicQuery(entity); }
/// <summary> /// You never need to call this, just access your BusinessEntity.Query property. /// </summary> /// <param name="entity">Passed in via the BusinessEntity</param> public DynamicQuery(BusinessEntity entity) { this._entity = entity; }
public MySql4DynamicQuery(BusinessEntity entity) : base(entity) { }
public PostgreSqlDynamicQuery(BusinessEntity entity) : base(entity) { }
public SQLiteDynamicQuery(BusinessEntity entity) : base(entity) { }
public FirebirdSqlDynamicQuery(BusinessEntity entity) : base(entity) { }
public VistaDBDynamicQuery(BusinessEntity entity) : base(entity) { }
public WhereClause(BusinessEntity entity) { this._entity = entity; }
override internal DynamicQuery CreateDynamicQuery(BusinessEntity entity) { return new MySql4DynamicQuery(entity); }