This commit is contained in:
sunkaixuan 2017-08-31 17:13:51 +08:00
parent 5c95784cac
commit bd5078e73f
5 changed files with 39 additions and 10 deletions

View File

@ -34,7 +34,7 @@ namespace SqlSugar
{
get
{
return ErrorMessage.GetThrowMessage("Connection open error . {0}", " 连接字符串出错了实在找不到原因请先Google错误.{0}.");
return ErrorMessage.GetThrowMessage("Connection open error . {0}", " 连接字符串出错了实在找不到原因请先Google错误{0}.");
}
}
}

View File

@ -16,6 +16,8 @@ namespace SqlSugar
get
{
if (base._DbConnection == null)
{
try
{
var mySqlConnectionString = base.Context.CurrentConnectionConfig.ConnectionString;
if (!mySqlConnectionString.ToLower().Contains("charset"))
@ -24,6 +26,11 @@ namespace SqlSugar
}
base._DbConnection = new MySqlConnection(mySqlConnectionString);
}
catch (Exception ex)
{
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message);
}
}
return base._DbConnection;
}
set

View File

@ -21,11 +21,19 @@ namespace SqlSugar
public override IDbConnection Connection
{
get
{
try
{
if (base._DbConnection == null)
{
base._DbConnection = new OracleConnection(base.Context.CurrentConnectionConfig.ConnectionString);
}
}
catch (Exception ex)
{
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message);
}
return base._DbConnection;
}
set

View File

@ -15,9 +15,16 @@ namespace SqlSugar
get
{
if (base._DbConnection == null)
{
try
{
base._DbConnection = new SqlConnection(base.Context.CurrentConnectionConfig.ConnectionString);
}
catch (Exception ex)
{
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message);
}
}
return base._DbConnection;
}
set

View File

@ -16,10 +16,17 @@ namespace SqlSugar
get
{
if (base._DbConnection == null)
{
try
{
var SQLiteConnectionString = base.Context.CurrentConnectionConfig.ConnectionString;
base._DbConnection = new SQLiteConnection(SQLiteConnectionString);
}
catch (Exception ex)
{
Check.Exception(true, ErrorMessage.ConnnectionOpen, ex.Message);
}
}
return base._DbConnection;
}
set