Update mysql db.Fastest

This commit is contained in:
sunkaixuna
2021-12-15 20:19:27 +08:00
parent ba0e8d01aa
commit cfd87478cd
2 changed files with 16 additions and 2 deletions

View File

@@ -75,8 +75,14 @@ namespace OrmTest
Db.CodeFirst.InitTables<Testdbbool>();
Db.DbMaintenance.TruncateTable("Testdbbool");
Db.Insertable(new Testdbbool() { isok=true }).UseMySql().ExecuteBulkCopy();
Db.Insertable(new Testdbbool() { isok = false }).UseMySql().ExecuteBulkCopy();
Db.Insertable(new Testdbbool() { isok = true }).UseMySql().ExecuteBulkCopy();
Db.Fastest<Testdbbool>().BulkCopy(new List<Testdbbool>() { new Testdbbool() { isok = true }, new Testdbbool() { isok = false } });
var list2= Db.Queryable<Testdbbool>().ToList();
if (!list2.Any(it => it.isok == false))
{
throw new Exception("blue copy");
}
Db.CodeFirst.InitTables<MicroBlog>();

View File

@@ -56,6 +56,7 @@ namespace SqlSugar
}
dt.TableName = GetTableName();
var columns = entityInfo.Columns;
var isMySql = this.context.CurrentConnectionConfig.DbType == DbType.MySql;
foreach (var item in datas)
{
var dr = dt.NewRow();
@@ -71,6 +72,13 @@ namespace SqlSugar
name = column.PropertyName;
}
var value = ValueConverter(column, PropertyCallAdapterProvider<T>.GetInstance(column.PropertyName).InvokeGet(item));
if (isMySql&& column.UnderType==UtilConstants.BoolType)
{
if (value.ObjToBool() == false)
{
value = DBNull.Value;
}
}
dr[name] = value;
}
dt.Rows.Add(dr);