init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
59
Sda.DataProvider/Wrappers/MSSQL/MSSQLBulkAdapter.cs
Normal file
59
Sda.DataProvider/Wrappers/MSSQL/MSSQLBulkAdapter.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
/// <summary>
|
||||
/// Microsoft SQL Server alapú bulk insert implementáció.
|
||||
/// </summary>
|
||||
public class MSSQLBulkAdapter : SDABulkAdapter
|
||||
{
|
||||
private readonly SqlBulkCopy bulkCopy;
|
||||
|
||||
/// <summary>
|
||||
/// Létrehoz egy Microsoft SQL Server specifikus bulk adapter példányt.
|
||||
/// </summary>
|
||||
/// <param name="bulkCopy">Egy SQL Server SqlBulkCopy példány, a
|
||||
/// tényleges bulk implementáció.</param>
|
||||
/// <exception cref="ArgumentNullException">Ha a kapott paraméter null.
|
||||
/// </exception>
|
||||
internal MSSQLBulkAdapter([NotNull] SqlBulkCopy bulkCopy)
|
||||
{
|
||||
if (bulkCopy == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(bulkCopy));
|
||||
}
|
||||
this.bulkCopy = bulkCopy;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void BulkInsert(DataTable source)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(source.TableName))
|
||||
{
|
||||
throw new ArgumentException("TableName property must be set to the target table name", nameof(source));
|
||||
}
|
||||
|
||||
if (source.Columns.Count == 0)
|
||||
{
|
||||
throw new ArgumentException("should contain at least 1 column to bulk insert", nameof(source));
|
||||
}
|
||||
|
||||
if (source.Rows.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bulkCopy.DestinationTableName = source.TableName;
|
||||
bulkCopy.WriteToServer(source);
|
||||
|
||||
//bulkCopy.NotifyAfter = 1000;
|
||||
//bulkCopy.SqlRowsCopied += (sender, args) =>
|
||||
//{
|
||||
|
||||
//};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
using System.Data.SqlClient;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLCommandBuilderWrapper : SDACommandBuilderWrapper
|
||||
{
|
||||
internal SqlCommandBuilder CommandBuilder;
|
||||
internal MSSQLDataAdapterWrapper InnerDataAdapter;
|
||||
|
||||
internal MSSQLCommandBuilderWrapper()
|
||||
{
|
||||
CommandBuilder = new SqlCommandBuilder();
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
internal MSSQLCommandBuilderWrapper(SDADataAdapterWrapper dataAdapter)
|
||||
: this()
|
||||
{
|
||||
// ReSharper disable once DoNotCallOverridableMethodsInConstructor
|
||||
DataAdapter = dataAdapter;
|
||||
}
|
||||
|
||||
protected override SDADataAdapterWrapper DataAdapter
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerDataAdapter;
|
||||
}
|
||||
set
|
||||
{
|
||||
InnerDataAdapter = (MSSQLDataAdapterWrapper)value;
|
||||
CommandBuilder.DataAdapter = InnerDataAdapter.DataAdapter;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DeriveParameters(SDACommandWrapper command)
|
||||
{
|
||||
SqlCommandBuilder.DeriveParameters(((MSSQLCommandWrapper)command).Command);
|
||||
}
|
||||
|
||||
public override SDACommandWrapper GetDeleteCommand()
|
||||
{
|
||||
return new MSSQLCommandWrapper(CommandBuilder.GetDeleteCommand());
|
||||
}
|
||||
|
||||
public override SDACommandWrapper GetInsertCommand()
|
||||
{
|
||||
return new MSSQLCommandWrapper(CommandBuilder.GetInsertCommand());
|
||||
}
|
||||
|
||||
public override SDACommandWrapper GetUpdateCommand()
|
||||
{
|
||||
return new MSSQLCommandWrapper(CommandBuilder.GetUpdateCommand());
|
||||
}
|
||||
|
||||
public override void RefreshSchema()
|
||||
{
|
||||
CommandBuilder.RefreshSchema();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
CommandBuilder.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLCommandParameterCollectionWrapper : SDACommandParameterCollectionWrapper
|
||||
{
|
||||
internal SqlParameterCollection Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return Command.Parameters;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Contains(SDACommandParameterWrapper parameter)
|
||||
{
|
||||
return Parameters.Contains("@" + parameter.ParameterName);
|
||||
}
|
||||
|
||||
public override int IndexOf(SDACommandParameterWrapper parameter)
|
||||
{
|
||||
return Parameters.IndexOf("@" + parameter.ParameterName);
|
||||
}
|
||||
|
||||
internal SqlCommand Command;
|
||||
|
||||
internal MSSQLCommandParameterCollectionWrapper(SqlCommand command)
|
||||
{
|
||||
Command = command;
|
||||
}
|
||||
|
||||
public override SDACommandParameterWrapper this[string parameterName]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Parameters.Contains("@" + parameterName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
SqlParameter parameter = Parameters["@" + parameterName];
|
||||
return new MSSQLCommandParameterWrapper(parameter);
|
||||
}
|
||||
set
|
||||
{
|
||||
Parameters["@" + parameterName] = ((MSSQLCommandParameterWrapper)value).Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
public override SDACommandParameterWrapper this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return new MSSQLCommandParameterWrapper(Parameters[index]);
|
||||
}
|
||||
set
|
||||
{
|
||||
Parameters[index] = ((MSSQLCommandParameterWrapper)value).Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
public override SDACommandParameterWrapper Add(SDACommandParameterWrapper parameter)
|
||||
{
|
||||
Parameters.Add(((MSSQLCommandParameterWrapper)parameter).Parameter);
|
||||
return parameter;
|
||||
}
|
||||
|
||||
public override SDACommandParameterWrapper Add(string name, SDADBType type)
|
||||
{
|
||||
SqlDbType dbtype = MSSQLParameterTypeConverter.ConvertSDADBTypeToSqlDbType(type);
|
||||
MSSQLCommandParameterWrapper result = new MSSQLCommandParameterWrapper(Command.Parameters.Add("@" + name, dbtype));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override SDACommandParameterWrapper Add(string name, SDADBType type, int size)
|
||||
{
|
||||
SqlDbType dbtype = MSSQLParameterTypeConverter.ConvertSDADBTypeToSqlDbType(type);
|
||||
MSSQLCommandParameterWrapper result = new MSSQLCommandParameterWrapper(Command.Parameters.Add("@" + name, dbtype, size));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override SDACommandParameterWrapper Add(string name, object value)
|
||||
{
|
||||
MSSQLCommandParameterWrapper result = new MSSQLCommandParameterWrapper(Command.Parameters.AddWithValue("@" + name, value));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void Remove(SDACommandParameterWrapper parameter)
|
||||
{
|
||||
Command.Parameters.Remove(((MSSQLCommandParameterWrapper)parameter).Parameter);
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
Command.Parameters.Clear();
|
||||
}
|
||||
|
||||
public override int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
return Parameters.Count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
148
Sda.DataProvider/Wrappers/MSSQL/MSSQLCommandParameterWrapper.cs
Normal file
148
Sda.DataProvider/Wrappers/MSSQL/MSSQLCommandParameterWrapper.cs
Normal file
|
@ -0,0 +1,148 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLCommandParameterWrapper : SDACommandParameterWrapper
|
||||
{
|
||||
internal SqlParameter Parameter;
|
||||
|
||||
internal MSSQLCommandParameterWrapper(SqlParameter parameter)
|
||||
{
|
||||
Parameter = parameter;
|
||||
}
|
||||
|
||||
protected override IDbDataParameter WrappedParameter
|
||||
{
|
||||
get
|
||||
{
|
||||
return Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
public override object Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return Parameter.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value is bool boolean)
|
||||
{
|
||||
Parameter.Value = boolean ? 'T' : 'F';
|
||||
}
|
||||
else
|
||||
{
|
||||
Parameter.Value = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override SDADBType DBType
|
||||
{
|
||||
get
|
||||
{
|
||||
return MSSQLParameterTypeConverter.ConvertSqlDbTypeToSDADBType(Parameter.SqlDbType);
|
||||
}
|
||||
set
|
||||
{
|
||||
Parameter.SqlDbType = MSSQLParameterTypeConverter.ConvertSDADBTypeToSqlDbType(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MSSQLParameterTypeConverter
|
||||
{
|
||||
public static SqlDbType ConvertSDADBTypeToSqlDbType(SDADBType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SDADBType.Int:
|
||||
return SqlDbType.Int;
|
||||
case SDADBType.String:
|
||||
return SqlDbType.NVarChar;
|
||||
case SDADBType.Binary:
|
||||
return SqlDbType.Image;
|
||||
case SDADBType.Char:
|
||||
return SqlDbType.NChar;
|
||||
case SDADBType.DateTime:
|
||||
return SqlDbType.DateTime;
|
||||
case SDADBType.Double:
|
||||
return SqlDbType.Float;
|
||||
case SDADBType.Boolean:
|
||||
return SqlDbType.Char;
|
||||
case SDADBType.LongString:
|
||||
return SqlDbType.NText;
|
||||
case SDADBType.LongInt:
|
||||
return SqlDbType.BigInt;
|
||||
case SDADBType.NonUnicodeString:
|
||||
return SqlDbType.VarChar;
|
||||
case SDADBType.Guid:
|
||||
return SqlDbType.UniqueIdentifier;
|
||||
default:
|
||||
throw new NotImplementedException(type.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static SDADBType ConvertSqlDbTypeToSDADBType(SqlDbType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SqlDbType.BigInt:
|
||||
return SDADBType.LongInt;
|
||||
case SqlDbType.Binary:
|
||||
return SDADBType.Binary;
|
||||
case SqlDbType.Bit:
|
||||
return SDADBType.Boolean;
|
||||
case SqlDbType.Char:
|
||||
return SDADBType.Char;
|
||||
case SqlDbType.DateTime:
|
||||
return SDADBType.DateTime;
|
||||
case SqlDbType.Decimal:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
case SqlDbType.Float:
|
||||
return SDADBType.Double;
|
||||
case SqlDbType.Image:
|
||||
return SDADBType.Binary;
|
||||
case SqlDbType.Int:
|
||||
return SDADBType.Int;
|
||||
case SqlDbType.Money:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
case SqlDbType.NChar:
|
||||
return SDADBType.Char;
|
||||
case SqlDbType.NText:
|
||||
return SDADBType.LongString;
|
||||
case SqlDbType.NVarChar:
|
||||
return SDADBType.String;
|
||||
case SqlDbType.Real:
|
||||
return SDADBType.Double;
|
||||
case SqlDbType.SmallDateTime:
|
||||
return SDADBType.DateTime;
|
||||
case SqlDbType.SmallInt:
|
||||
return SDADBType.Int;
|
||||
case SqlDbType.SmallMoney:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
case SqlDbType.Text:
|
||||
return SDADBType.LongString;
|
||||
case SqlDbType.Timestamp:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
case SqlDbType.TinyInt:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
case SqlDbType.UniqueIdentifier:
|
||||
return SDADBType.Guid;
|
||||
case SqlDbType.VarBinary:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
case SqlDbType.VarChar:
|
||||
return SDADBType.NonUnicodeString;
|
||||
case SqlDbType.Variant:
|
||||
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "Conversion from '{0}' is not supported.", type));
|
||||
default:
|
||||
throw new NotImplementedException(type.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
206
Sda.DataProvider/Wrappers/MSSQL/MSSQLCommandWrapper.cs
Normal file
206
Sda.DataProvider/Wrappers/MSSQL/MSSQLCommandWrapper.cs
Normal file
|
@ -0,0 +1,206 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLCommandWrapper : SDACommandWrapper
|
||||
{
|
||||
internal SqlCommand Command;
|
||||
internal MSSQLConnectionWrapper ConnectionWrapper;
|
||||
internal MSSQLCommandParameterCollectionWrapper InnerParameters;
|
||||
internal MSSQLTransactionWrapper InnerTransaction;
|
||||
|
||||
internal MSSQLCommandWrapper()
|
||||
{
|
||||
try
|
||||
{
|
||||
// ReSharper disable once UseObjectOrCollectionInitializer
|
||||
Command = new SqlCommand();
|
||||
Command.CommandTimeout = 300;
|
||||
InnerParameters = new MSSQLCommandParameterCollectionWrapper(Command);
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (Command != null)
|
||||
{
|
||||
Command.Dispose();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal MSSQLCommandWrapper(SqlCommand command)
|
||||
{
|
||||
Command = command;
|
||||
Command.CommandTimeout = 300;
|
||||
InnerParameters = new MSSQLCommandParameterCollectionWrapper(Command);
|
||||
}
|
||||
|
||||
protected override IDbCommand WrappedCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return Command;
|
||||
}
|
||||
}
|
||||
|
||||
string SafeGetParametersText()
|
||||
{
|
||||
string result = "";
|
||||
for (int i = 0; i < Command.Parameters.Count; i++)
|
||||
{
|
||||
result += Command.Parameters[i].ParameterName + "=";
|
||||
if (Command.Parameters[i].Value == null)
|
||||
{
|
||||
result += @"csharpnull, ";
|
||||
}
|
||||
else if (Command.Parameters[i].Value == DBNull.Value)
|
||||
{
|
||||
result += @"DBNULL, ";
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "[" + Command.Parameters[i].Value + "], ";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
string SafeGetCommandText()
|
||||
{
|
||||
if (Command != null)
|
||||
{
|
||||
return Command.CommandText + "\n" + SafeGetParametersText();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public override SDAConnectionWrapper Connection
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConnectionWrapper;
|
||||
}
|
||||
set
|
||||
{
|
||||
MSSQLConnectionWrapper connection = value as MSSQLConnectionWrapper;
|
||||
ConnectionWrapper = connection;
|
||||
Command.Connection = connection?.Connection;
|
||||
}
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities")]
|
||||
public override string CommandText
|
||||
{
|
||||
get
|
||||
{
|
||||
string temp = Command.CommandText.Replace("@p", ":p");
|
||||
return temp;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
Command.CommandText = "";
|
||||
return;
|
||||
}
|
||||
string temp = value.Replace(":p", "@p");
|
||||
Command.CommandText = temp;
|
||||
}
|
||||
}
|
||||
|
||||
public override int ExecuteNonQuery()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Command.ExecuteNonQuery();
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText());
|
||||
}
|
||||
}
|
||||
|
||||
public override SDADataReaderWrapper ExecuteReader()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MSSQLDataReaderWrapper(Command.ExecuteReader());
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText());
|
||||
}
|
||||
}
|
||||
|
||||
public override SDADataReaderWrapper ExecuteReader(CommandBehavior commandBehavior)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MSSQLDataReaderWrapper(Command.ExecuteReader(commandBehavior));
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText());
|
||||
}
|
||||
}
|
||||
|
||||
public override object ExecuteScalar()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Command.ExecuteScalar();
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText());
|
||||
}
|
||||
}
|
||||
|
||||
public override SDATransactionWrapper Transaction
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerTransaction;
|
||||
}
|
||||
set
|
||||
{
|
||||
MSSQLTransactionWrapper transaction = value as MSSQLTransactionWrapper;
|
||||
InnerTransaction = transaction;
|
||||
Command.Transaction = transaction?.Transaction;
|
||||
}
|
||||
}
|
||||
|
||||
bool _disposed;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
if (disposing)
|
||||
{
|
||||
if (Command != null)
|
||||
{
|
||||
Command.Dispose();
|
||||
Command = null;
|
||||
}
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
public override SDACommandParameterCollectionWrapper Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace SDA.DataProvider.Wrappers.MSSQL
|
||||
{
|
||||
internal class MSSQLConnectionStringBuilderWrapper : IDisposable
|
||||
{
|
||||
SqlConnectionStringBuilder builder;
|
||||
|
||||
public MSSQLConnectionStringBuilderWrapper(string connectionstring)
|
||||
{
|
||||
builder = new SqlConnectionStringBuilder(connectionstring);
|
||||
|
||||
GenerateConnectionString();
|
||||
}
|
||||
|
||||
public string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return builder.ConnectionString;
|
||||
}
|
||||
set
|
||||
{
|
||||
builder.ConnectionString = value;
|
||||
|
||||
GenerateConnectionString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ha megvan adva ConnectionTimeout a konfigban, akkor felülírja a connection stringet
|
||||
/// </summary>
|
||||
void GenerateConnectionString()
|
||||
{
|
||||
if (Configuration.ConnectionTimeout.HasValue
|
||||
&& builder.ConnectionString.IndexOf("Connect Timeout", StringComparison.OrdinalIgnoreCase) == -1)
|
||||
{
|
||||
ConnectionTimeout = Configuration.ConnectionTimeout.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
builder = null;
|
||||
}
|
||||
|
||||
public int ConnectionTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return builder.ConnectTimeout;
|
||||
}
|
||||
set
|
||||
{
|
||||
builder.ConnectTimeout = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
182
Sda.DataProvider/Wrappers/MSSQL/MSSQLConnectionWrapper.cs
Normal file
182
Sda.DataProvider/Wrappers/MSSQL/MSSQLConnectionWrapper.cs
Normal file
|
@ -0,0 +1,182 @@
|
|||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using SDA.DataProvider.Core;
|
||||
using SDA.DataProvider.Wrappers.MSSQL;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLConnectionWrapper : SDAConnectionWrapper
|
||||
{
|
||||
internal SqlConnection Connection;
|
||||
internal MSSQLConnectionStringBuilderWrapper ConnectionStringBuilder;
|
||||
|
||||
protected override IDbConnection WrappedConnection
|
||||
{
|
||||
get
|
||||
{
|
||||
return Connection;
|
||||
}
|
||||
}
|
||||
|
||||
public MSSQLConnectionWrapper()
|
||||
{
|
||||
Connection = new SqlConnection();
|
||||
}
|
||||
|
||||
public MSSQLConnectionWrapper(string connectionString)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectionStringBuilder = new MSSQLConnectionStringBuilderWrapper(connectionString);
|
||||
Connection = new SqlConnection(ConnectionStringBuilder.ConnectionString);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ConnectionStringBuilder.Dispose();
|
||||
Connection.Dispose();
|
||||
|
||||
ConnectionStringBuilder = null;
|
||||
Connection = null;
|
||||
}
|
||||
|
||||
public override void Open()
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection.Open();
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override SDABulkAdapter CreateBulkAdapter(SDATransaction transaction = null)
|
||||
{
|
||||
SqlBulkCopy sqlBulkCopy;
|
||||
|
||||
if (transaction == null)
|
||||
{
|
||||
sqlBulkCopy = new SqlBulkCopy(Connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlBulkCopy = new SqlBulkCopy(Connection, SqlBulkCopyOptions.Default, (SqlTransaction)transaction.Transaction.NativeTransaction);
|
||||
}
|
||||
return new MSSQLBulkAdapter(sqlBulkCopy);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ResetConnectionPool(bool all = false)
|
||||
{
|
||||
if (all)
|
||||
{
|
||||
SqlConnection.ClearAllPools();
|
||||
}
|
||||
else
|
||||
{
|
||||
SqlConnection.ClearPool(Connection);
|
||||
}
|
||||
}
|
||||
|
||||
public override SDATransactionWrapper BeginTransaction()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MSSQLTransactionWrapper(this, Connection.BeginTransaction());
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public override SDATransactionWrapper BeginTransaction(IsolationLevel isolationLevel)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MSSQLTransactionWrapper(this, Connection.BeginTransaction(isolationLevel));
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public override SDACommandWrapper CreateCommand()
|
||||
{
|
||||
MSSQLCommandWrapper result = null;
|
||||
try
|
||||
{
|
||||
// ReSharper disable once UseObjectOrCollectionInitializer
|
||||
result = new MSSQLCommandWrapper();
|
||||
result.Connection = this;
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (result != null)
|
||||
{
|
||||
result.Dispose();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ConnectionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return Connection.ConnectionString;
|
||||
}
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ConnectionStringBuilder == null)
|
||||
{
|
||||
ConnectionStringBuilder = new MSSQLConnectionStringBuilderWrapper(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ConnectionStringBuilder.ConnectionString = value;
|
||||
}
|
||||
|
||||
Connection.ConnectionString = ConnectionStringBuilder.ConnectionString;
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int ConnectionTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return Connection.ConnectionTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ChangeDatabase(string databaseName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Connection.ChangeDatabase(databaseName);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
262
Sda.DataProvider/Wrappers/MSSQL/MSSQLDataAdapterWrapper.cs
Normal file
262
Sda.DataProvider/Wrappers/MSSQL/MSSQLDataAdapterWrapper.cs
Normal file
|
@ -0,0 +1,262 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlClient;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
internal class MSSQLDataAdapterWrapper : SDADataAdapterWrapper
|
||||
{
|
||||
internal SqlDataAdapter DataAdapter;
|
||||
internal MSSQLCommandWrapper InnerDeleteCommand;
|
||||
internal MSSQLCommandWrapper InnerInsertCommand;
|
||||
internal MSSQLCommandWrapper InnerSelectCommand;
|
||||
internal MSSQLCommandWrapper InnerUpdateCommand;
|
||||
|
||||
static string SafeGetParametersText(SDACommandWrapper command)
|
||||
{
|
||||
string result = "";
|
||||
for (int i = 0; i < command.Parameters.Count; i++)
|
||||
{
|
||||
result += command.Parameters[i].ParameterName + "=";
|
||||
if (command.Parameters[i].Value == null)
|
||||
{
|
||||
result += @"csharpnull, ";
|
||||
}
|
||||
else if (command.Parameters[i].Value == DBNull.Value)
|
||||
{
|
||||
result += @"DBNULL, ";
|
||||
}
|
||||
else
|
||||
{
|
||||
result += "[" + command.Parameters[i].Value + "], ";
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static string SafeGetCommandText(SDACommandWrapper command)
|
||||
{
|
||||
if (command != null)
|
||||
{
|
||||
return command.CommandText + "\n" + SafeGetParametersText(command);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public MSSQLDataAdapterWrapper()
|
||||
{
|
||||
DataAdapter = new SqlDataAdapter();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
DataAdapter.Dispose();
|
||||
DataAdapter = null;
|
||||
InnerDeleteCommand = null;
|
||||
InnerInsertCommand = null;
|
||||
InnerSelectCommand = null;
|
||||
InnerUpdateCommand = null;
|
||||
}
|
||||
|
||||
public override SDACommandWrapper DeleteCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerDeleteCommand;
|
||||
}
|
||||
set
|
||||
{
|
||||
MSSQLCommandWrapper command = value as MSSQLCommandWrapper;
|
||||
DataAdapter.DeleteCommand = command != null ? command.Command : null;
|
||||
InnerDeleteCommand = command;
|
||||
}
|
||||
}
|
||||
|
||||
public override SDACommandWrapper InsertCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerInsertCommand;
|
||||
}
|
||||
set
|
||||
{
|
||||
MSSQLCommandWrapper command = value as MSSQLCommandWrapper;
|
||||
DataAdapter.InsertCommand = command?.Command;
|
||||
InnerInsertCommand = command;
|
||||
}
|
||||
}
|
||||
|
||||
public override SDACommandWrapper SelectCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerSelectCommand;
|
||||
}
|
||||
set
|
||||
{
|
||||
MSSQLCommandWrapper command = value as MSSQLCommandWrapper;
|
||||
DataAdapter.SelectCommand = command?.Command;
|
||||
InnerSelectCommand = command;
|
||||
}
|
||||
}
|
||||
|
||||
public override SDACommandWrapper UpdateCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerUpdateCommand;
|
||||
}
|
||||
set
|
||||
{
|
||||
MSSQLCommandWrapper command = value as MSSQLCommandWrapper;
|
||||
DataAdapter.UpdateCommand = command?.Command;
|
||||
InnerUpdateCommand = command;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool AcceptChangesDuringFill
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataAdapter.AcceptChangesDuringFill;
|
||||
}
|
||||
set
|
||||
{
|
||||
DataAdapter.AcceptChangesDuringFill = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ContinueUpdateOnError
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataAdapter.ContinueUpdateOnError;
|
||||
}
|
||||
set
|
||||
{
|
||||
DataAdapter.ContinueUpdateOnError = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MissingMappingAction MissingMappingAction
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataAdapter.MissingMappingAction;
|
||||
}
|
||||
set
|
||||
{
|
||||
DataAdapter.MissingMappingAction = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override MissingSchemaAction MissingSchemaAction
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataAdapter.MissingSchemaAction;
|
||||
}
|
||||
set
|
||||
{
|
||||
DataAdapter.MissingSchemaAction = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override DataTableMappingCollection TableMappings
|
||||
{
|
||||
get
|
||||
{
|
||||
return DataAdapter.TableMappings;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Fill(DataSet dataSet)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DataAdapter.Fill(dataSet);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText(InnerSelectCommand));
|
||||
}
|
||||
|
||||
}
|
||||
public override int Fill(DataSet dts, int startRecord, int endRecord, string srcTable)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DataAdapter.Fill(dts, startRecord, (endRecord - startRecord) + 1, srcTable);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText(InnerSelectCommand));
|
||||
}
|
||||
}
|
||||
|
||||
public override int Fill(DataTable dataTable)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DataAdapter.Fill(dataTable);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText(InnerSelectCommand));
|
||||
}
|
||||
}
|
||||
|
||||
public override DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DataAdapter.FillSchema(dataSet, schemaType);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText(InnerSelectCommand));
|
||||
}
|
||||
}
|
||||
|
||||
public override DataTable FillSchema(DataTable dataTable, SchemaType schemaType)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DataAdapter.FillSchema(dataTable, schemaType);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText(InnerSelectCommand));
|
||||
}
|
||||
}
|
||||
|
||||
public override DataTable[] FillSchema(DataSet dataSet, SchemaType schemaType, string srcTable)
|
||||
{
|
||||
try
|
||||
{
|
||||
return DataAdapter.FillSchema(dataSet, schemaType, srcTable);
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception, SafeGetCommandText(InnerSelectCommand));
|
||||
}
|
||||
}
|
||||
|
||||
public override int Update(DataRow[] dataRows)
|
||||
{
|
||||
return DataAdapter.Update(dataRows);
|
||||
}
|
||||
|
||||
public override int Update(DataSet dataSet)
|
||||
{
|
||||
return DataAdapter.Update(dataSet);
|
||||
}
|
||||
|
||||
public override int Update(DataTable dataTable)
|
||||
{
|
||||
return DataAdapter.Update(dataTable);
|
||||
}
|
||||
}
|
||||
}
|
191
Sda.DataProvider/Wrappers/MSSQL/MSSQLDataReaderWrapper.cs
Normal file
191
Sda.DataProvider/Wrappers/MSSQL/MSSQLDataReaderWrapper.cs
Normal file
|
@ -0,0 +1,191 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLDataReaderWrapper : SDADataReaderWrapper
|
||||
{
|
||||
internal SqlDataReader Reader;
|
||||
|
||||
internal MSSQLDataReaderWrapper(SqlDataReader reader)
|
||||
{
|
||||
Reader = reader;
|
||||
}
|
||||
|
||||
protected override IDataReader WrappedDataReader
|
||||
{
|
||||
get
|
||||
{
|
||||
return Reader;
|
||||
}
|
||||
}
|
||||
|
||||
bool _disposed;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (disposing)
|
||||
{
|
||||
if (Reader != null)
|
||||
{
|
||||
Reader.Dispose();
|
||||
Reader = null;
|
||||
}
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
Reader.Close();
|
||||
}
|
||||
|
||||
public override bool Read()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Reader.Read();
|
||||
}
|
||||
catch (SqlException ex)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool NextResult()
|
||||
{
|
||||
return Reader.NextResult();
|
||||
}
|
||||
|
||||
public override bool IsDBNull(int index)
|
||||
{
|
||||
return Reader.IsDBNull(index);
|
||||
}
|
||||
|
||||
public override bool GetBoolean(int index)
|
||||
{
|
||||
object value = GetValue(index);
|
||||
if (value is Boolean)
|
||||
{
|
||||
return (bool)value;
|
||||
}
|
||||
char temp = GetChar(index);
|
||||
switch (temp)
|
||||
{
|
||||
case '0':
|
||||
case 'f':
|
||||
case 'F':
|
||||
case 'n':
|
||||
case 'N':
|
||||
return false;
|
||||
case '1':
|
||||
case 't':
|
||||
case 'T':
|
||||
case 'y':
|
||||
case 'Y':
|
||||
return true;
|
||||
default:
|
||||
throw new SDADataProviderException(new InvalidCastException());
|
||||
}
|
||||
}
|
||||
|
||||
public override byte GetByte(int index)
|
||||
{
|
||||
return Reader.GetByte(index);
|
||||
}
|
||||
|
||||
public override char GetChar(int index)
|
||||
{
|
||||
string temp = Reader.GetString(index);
|
||||
if (temp.Length == 1)
|
||||
{
|
||||
return temp[0];
|
||||
}
|
||||
throw new InvalidCastException();
|
||||
}
|
||||
|
||||
public override DateTime GetDateTime(int index)
|
||||
{
|
||||
return Reader.GetDateTime(index);
|
||||
}
|
||||
|
||||
public override decimal GetDecimal(int index)
|
||||
{
|
||||
return Convert.ToDecimal(Reader.GetValue(index), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public override double GetDouble(int index)
|
||||
{
|
||||
return Convert.ToDouble(Reader.GetValue(index), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public override short GetInt16(int index)
|
||||
{
|
||||
return Convert.ToInt16(Reader.GetValue(index), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public override int GetInt32(int index)
|
||||
{
|
||||
return Convert.ToInt32(Reader.GetValue(index), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public override long GetInt64(int index)
|
||||
{
|
||||
return Convert.ToInt64(Reader.GetValue(index), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
public override string GetString(int index)
|
||||
{
|
||||
return Reader.GetString(index);
|
||||
}
|
||||
|
||||
public override string GetLongString(int index)
|
||||
{
|
||||
return Reader.GetString(index);
|
||||
}
|
||||
|
||||
public override object GetValue(int index)
|
||||
{
|
||||
return Reader.GetValue(index);
|
||||
}
|
||||
|
||||
public override int GetValues(object[] values)
|
||||
{
|
||||
return Reader.GetValues(values);
|
||||
}
|
||||
|
||||
public override DataTable GetSchemaTable()
|
||||
{
|
||||
return Reader.GetSchemaTable();
|
||||
}
|
||||
|
||||
public override Guid GetGuid(int i)
|
||||
{
|
||||
return Reader.GetGuid(i);
|
||||
}
|
||||
|
||||
public override object this[string name] => Reader[name];
|
||||
|
||||
public override object this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return Reader[index];
|
||||
}
|
||||
}
|
||||
|
||||
public override int FieldCount => Reader.FieldCount;
|
||||
|
||||
public override int GetOrdinal(string fieldname)
|
||||
{
|
||||
return Reader.GetOrdinal(fieldname);
|
||||
}
|
||||
}
|
||||
}
|
50
Sda.DataProvider/Wrappers/MSSQL/MSSQLExceptionHelper.cs
Normal file
50
Sda.DataProvider/Wrappers/MSSQL/MSSQLExceptionHelper.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using System.Data.SqlClient;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLExceptionHelper
|
||||
{
|
||||
public static SDADataProviderException TranslateSqlException(SqlException exception)
|
||||
{
|
||||
return TranslateSqlException(exception, "");
|
||||
}
|
||||
|
||||
public static SDADataProviderException TranslateSqlException(SqlException exception, string commandText)
|
||||
{
|
||||
switch ((MSSQLErrors)exception.Number)
|
||||
{
|
||||
case MSSQLErrors.ForeignKeyViolation:
|
||||
return new ForeignKeyViolationException(exception, exception.Number, commandText);
|
||||
case MSSQLErrors.UniqueKeyViolation:
|
||||
case MSSQLErrors.CannotInsertDuplicateKeyRow:
|
||||
return new UniqueKeyViolationException(exception, exception.Number, commandText);
|
||||
case MSSQLErrors.DeadlockDetected:
|
||||
return new DeadlockException(exception, exception.Number, commandText);
|
||||
case MSSQLErrors.CommandTimeout:
|
||||
return new CommandTimeoutException(exception, exception.Number, commandText);
|
||||
case MSSQLErrors.TableOrViewDoesNotExist:
|
||||
return new TableOrViewNotExistsException(exception, exception.Number, commandText);
|
||||
case MSSQLErrors.UntitledCommunicationError:
|
||||
case MSSQLErrors.PreLoginHandshake:
|
||||
case MSSQLErrors.ConnectionError:
|
||||
return new CommunicationErrorException(exception, exception.Number, false);
|
||||
default:
|
||||
return new SDADataProviderException(exception, SDADataProviderError.Unknown, exception.Number, commandText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum MSSQLErrors
|
||||
{
|
||||
CommandTimeout = -2,
|
||||
ForeignKeyViolation = 547,
|
||||
UniqueKeyViolation = 2627,
|
||||
CannotInsertDuplicateKeyRow = 2601,
|
||||
CannotInsertNull = 515,
|
||||
TableOrViewDoesNotExist = 208,
|
||||
ConnectionError = 1231,
|
||||
PreLoginHandshake = 10054,
|
||||
UntitledCommunicationError = 2,
|
||||
DeadlockDetected = 1205,
|
||||
}
|
||||
}
|
68
Sda.DataProvider/Wrappers/MSSQL/MSSQLTransactionWrapper.cs
Normal file
68
Sda.DataProvider/Wrappers/MSSQL/MSSQLTransactionWrapper.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using SDA.DataProvider.Core;
|
||||
|
||||
namespace SDA.DataProvider.MSSQLWrappers
|
||||
{
|
||||
class MSSQLTransactionWrapper : SDATransactionWrapper
|
||||
{
|
||||
private MSSQLConnectionWrapper connection;
|
||||
|
||||
public SqlTransaction Transaction;
|
||||
|
||||
internal MSSQLTransactionWrapper(MSSQLConnectionWrapper connection, SqlTransaction transaction)
|
||||
{
|
||||
this.connection = connection;
|
||||
Transaction = transaction;
|
||||
}
|
||||
|
||||
public override void Commit()
|
||||
{
|
||||
try
|
||||
{
|
||||
Transaction.Commit();
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Rollback()
|
||||
{
|
||||
try
|
||||
{
|
||||
Transaction.Rollback();
|
||||
}
|
||||
catch (SqlException exception)
|
||||
{
|
||||
throw MSSQLExceptionHelper.TranslateSqlException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
internal override IDbTransaction NativeTransaction => Transaction;
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Transaction.Dispose();
|
||||
Transaction = null;
|
||||
}
|
||||
|
||||
public override SDAConnectionWrapper Connection
|
||||
{
|
||||
get
|
||||
{
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
||||
public override IsolationLevel IsolationLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
return Transaction.IsolationLevel;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue