Update Core

This commit is contained in:
sunkaixuan 2019-05-18 10:05:28 +08:00
parent f8d97e411b
commit 878fc4e433
5 changed files with 16 additions and 17 deletions

View File

@ -11,8 +11,7 @@ namespace OrmTest.Demo
public static SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.Oracle, IsAutoCloseConnection = true });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it=>it.ParameterName,it=>it.Value)));
Console.WriteLine();

View File

@ -57,8 +57,7 @@ namespace OrmTest.UnitTest
public SqlSugarClient GetInstance2()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { InitKeyType = InitKeyType.Attribute, ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" + db.RewritableMethods.SerializeObject(pars));
Console.WriteLine();

View File

@ -128,9 +128,8 @@ namespace OrmTest.UnitTest
public new SqlSugarClient GetInstance()
{
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });
db.Ado.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer });;
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql + " " + pars);
};

View File

@ -30,7 +30,7 @@ namespace OrmTest.UnitTest
using (var db = GetInstance())
{
//db.Database.IsEnableLogEvent = true;
db.Ado.LogEventStarting = (sql, pars) =>
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql + " " + pars);
};

View File

@ -13,6 +13,7 @@ namespace SqlSugar
private static bool IsTrySqlite = false;
private static bool IsTryOracle = false;
private static bool IsTryPgSql = false;
public static void TryJsonNet()
{
if (!IsTryJsonNet)
@ -26,11 +27,12 @@ namespace SqlSugar
{
var message = ErrorMessage.GetThrowMessage(
" SqlSugar Some functions are used in newtonsoft ,Nuget references Newtonsoft.Json 9.0.0.1 + .",
" SqlSugar 部分功能用到Newtonsoft.Json.dll需要在Nuget上安装 Newtonsoft.Json 9.0.0.1及以上版本如果有版本兼容问题请先删除原有引用(注意:所有项目类库),全部重新从NUGET下载,如果还不明白,请查看详细教程 http://www.codeisbug.com/Doc/8/1154");
" SqlSugar 部分功能用到Newtonsoft.Json.dll需要在Nuget上安装 Newtonsoft.Json 9.0.0.1及以上版本如果有版本兼容问题请先删除原有引用");
throw new Exception(message);
}
}
}
public static void TryMySqlData()
{
if (!IsTryMySqlData)
@ -64,14 +66,14 @@ namespace SqlSugar
catch
{
var message = ErrorMessage.GetThrowMessage(
"You need to refer to Npgsql.dll",
"需要引用Npgsql.dll请在Nuget安装最新稳定版本,如果有版本兼容问题请先删除原有引用");
"You need to refer to Npgsql 3.2.7",
"你需要引用 Npgsql 3.2.7及以上版本");
throw new Exception(message);
}
}
}
internal static void TryOracle()
public static void TryOracle()
{
if (!IsTryOracle)
{
@ -84,8 +86,8 @@ namespace SqlSugar
catch
{
var message = ErrorMessage.GetThrowMessage(
"You need to refer to Oracle.ManagedDataAccess.dll",
"需要引用ManagedDataAccess.dll请在Nuget安装最新稳定版本,如果有版本兼容问题请先删除原有引用");
"You need to refer to Oracle.ManagedDataAccess.Core",
"你需要引用 Oracle.ManagedDataAccess.Core");
throw new Exception(message);
}
}
@ -104,11 +106,11 @@ namespace SqlSugar
catch (Exception ex)
{
var message = ErrorMessage.GetThrowMessage(
"You need to refer to System.Data.SQLite.dll." + ex.Message,
"你需要引用System.Data.SQLite.dll,如果有版本兼容问题请先删除原有引用");
"You need to refer to Microsoft.Data.Sqlite." + ex.Message,
"你需要引用Microsoft.Data.Sqlite,如果有版本兼容问题请先删除原有引用");
throw new Exception(message);
}
}
}
}
}
}