init
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace SDA.DataProvider.Core
|
||||
{
|
||||
public abstract class SDAConnectionWrapper : IDbConnection
|
||||
{
|
||||
[NotNull]
|
||||
public abstract SDACommandWrapper CreateCommand();
|
||||
|
||||
/// <summary>
|
||||
/// Létrehoz egy <see cref="SDABulkAdapter"/>-t nagyon gyors adatbeszúrásokhoz.
|
||||
/// </summary>
|
||||
/// <param name="transaction">
|
||||
/// Opcionális <see cref="SDATransaction"/> objektum, ha nincs megadva, akkor a bulk
|
||||
/// művelet _nem_ fut tranzakcióban, azaz ha megáll egy hiba miatt,
|
||||
/// akkor a már beszúrt sorok nem görgetődnek vissza!
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Egy új <see cref="SDABulkAdapter"/>.
|
||||
/// </returns>
|
||||
[NotNull]
|
||||
public abstract SDABulkAdapter CreateBulkAdapter(SDATransaction transaction = null);
|
||||
|
||||
/// <summary>
|
||||
/// Üresre törli az adatbázis-szerver connection pool-ját.
|
||||
/// </summary>
|
||||
/// <param name="all">
|
||||
/// True érték esetén az összes pool-t alaphelyzetbe hozza,
|
||||
/// False érték esetén csak az adott kapcsolathoz tartozót.
|
||||
/// </param>
|
||||
public abstract void ResetConnectionPool(bool all = false);
|
||||
|
||||
[NotNull]
|
||||
public abstract SDATransactionWrapper BeginTransaction();
|
||||
|
||||
[NotNull]
|
||||
public abstract SDATransactionWrapper BeginTransaction(IsolationLevel isolationLevel);
|
||||
|
||||
[NotNull]
|
||||
protected abstract IDbConnection WrappedConnection { get; }
|
||||
|
||||
public SqlConnection SqlConnection
|
||||
{
|
||||
get { return (SqlConnection)WrappedConnection; }
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public abstract void Dispose();
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDbConnection Members
|
||||
|
||||
[CanBeNull]
|
||||
public abstract string ConnectionString { get; set; }
|
||||
|
||||
public abstract int ConnectionTimeout { get; }
|
||||
|
||||
[CanBeNull]
|
||||
public virtual string Database => WrappedConnection.Database;
|
||||
|
||||
public virtual ConnectionState State => WrappedConnection.State;
|
||||
|
||||
[NotNull]
|
||||
IDbTransaction IDbConnection.BeginTransaction(IsolationLevel il)
|
||||
{
|
||||
return BeginTransaction(il);
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
IDbTransaction IDbConnection.BeginTransaction()
|
||||
{
|
||||
return BeginTransaction();
|
||||
}
|
||||
|
||||
public abstract void ChangeDatabase(string databaseName);
|
||||
|
||||
public virtual void Close()
|
||||
{
|
||||
WrappedConnection.Close();
|
||||
}
|
||||
|
||||
IDbCommand IDbConnection.CreateCommand()
|
||||
{
|
||||
return CreateCommand();
|
||||
}
|
||||
|
||||
public virtual void Open()
|
||||
{
|
||||
WrappedConnection.Open();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user