mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Update .net core project
This commit is contained in:
@@ -10,6 +10,7 @@ namespace SqlSugar
|
|||||||
public class FastBuilder
|
public class FastBuilder
|
||||||
{
|
{
|
||||||
public virtual bool IsActionUpdateColumns { get; set; }
|
public virtual bool IsActionUpdateColumns { get; set; }
|
||||||
|
public virtual DbFastestProperties DbFastestProperties { get; set; }
|
||||||
public SqlSugarProvider Context { get; set; }
|
public SqlSugarProvider Context { get; set; }
|
||||||
public virtual string CharacterSet { get; set; }
|
public virtual string CharacterSet { get; set; }
|
||||||
public virtual string UpdateSql { get; set; } = @"UPDATE TM
|
public virtual string UpdateSql { get; set; } = @"UPDATE TM
|
||||||
|
@@ -42,6 +42,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private DataTable ToDdateTable(List<T> datas)
|
private DataTable ToDdateTable(List<T> datas)
|
||||||
{
|
{
|
||||||
|
var builder = GetBuider();
|
||||||
DataTable tempDataTable = ReflectionInoCore<DataTable>.GetInstance().GetOrCreate("BulkCopyAsync" + typeof(T).FullName,
|
DataTable tempDataTable = ReflectionInoCore<DataTable>.GetInstance().GetOrCreate("BulkCopyAsync" + typeof(T).FullName,
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
@@ -87,7 +88,14 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
else if (column.UnderType == UtilConstants.DateTimeOffsetType&& value!=null && value != DBNull.Value)
|
else if (column.UnderType == UtilConstants.DateTimeOffsetType&& value!=null && value != DBNull.Value)
|
||||||
{
|
{
|
||||||
value = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
if (builder.DbFastestProperties != null && builder.DbFastestProperties.HasOffsetTime == true)
|
||||||
|
{
|
||||||
|
//Don't need to deal with
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = UtilMethods.ConvertFromDateTimeOffset((DateTimeOffset)value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dr[name] = value;
|
dr[name] = value;
|
||||||
}
|
}
|
||||||
|
13
Src/Asp.NetCore2/SqlSugar/Entities/DbFastestProperties.cs
Normal file
13
Src/Asp.NetCore2/SqlSugar/Entities/DbFastestProperties.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public class DbFastestProperties
|
||||||
|
{
|
||||||
|
public bool HasOffsetTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -10,6 +10,7 @@ namespace SqlSugar
|
|||||||
public interface IFastBuilder
|
public interface IFastBuilder
|
||||||
{
|
{
|
||||||
bool IsActionUpdateColumns { get; set; }
|
bool IsActionUpdateColumns { get; set; }
|
||||||
|
DbFastestProperties DbFastestProperties { get; set; }
|
||||||
SqlSugarProvider Context { get; set; }
|
SqlSugarProvider Context { get; set; }
|
||||||
string CharacterSet { get; set; }
|
string CharacterSet { get; set; }
|
||||||
Task<int> UpdateByTempAsync(string tableName,string tempName,string [] updateColumns,string[] whereColumns);
|
Task<int> UpdateByTempAsync(string tableName,string tempName,string [] updateColumns,string[] whereColumns);
|
||||||
|
@@ -6,6 +6,17 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
public class SqlServerDbBind : DbBindProvider
|
public class SqlServerDbBind : DbBindProvider
|
||||||
{
|
{
|
||||||
|
public override string GetDbTypeName(string csharpTypeName)
|
||||||
|
{
|
||||||
|
if (csharpTypeName == nameof(DateTimeOffset))
|
||||||
|
{
|
||||||
|
return nameof(DateTimeOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return base.GetDbTypeName(csharpTypeName);
|
||||||
|
}
|
||||||
|
}
|
||||||
public override List<KeyValuePair<string, CSharpDataType>> MappingTypes
|
public override List<KeyValuePair<string, CSharpDataType>> MappingTypes
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@@ -13,6 +13,9 @@ namespace SqlSugar
|
|||||||
public class SqlServerFastBuilder:FastBuilder,IFastBuilder
|
public class SqlServerFastBuilder:FastBuilder,IFastBuilder
|
||||||
{
|
{
|
||||||
public override bool IsActionUpdateColumns { get; set; } = true;
|
public override bool IsActionUpdateColumns { get; set; } = true;
|
||||||
|
public override DbFastestProperties DbFastestProperties { get; set; } = new DbFastestProperties() {
|
||||||
|
HasOffsetTime=true
|
||||||
|
};
|
||||||
public async Task<int> ExecuteBulkCopyAsync(DataTable dt)
|
public async Task<int> ExecuteBulkCopyAsync(DataTable dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@ namespace SqlSugar
|
|||||||
public string CharacterSet { get; set; }
|
public string CharacterSet { get; set; }
|
||||||
private DataTable UpdateDataTable { get; set; }
|
private DataTable UpdateDataTable { get; set; }
|
||||||
public bool IsActionUpdateColumns { get; set; }
|
public bool IsActionUpdateColumns { get; set; }
|
||||||
|
public DbFastestProperties DbFastestProperties { get; set; } = new DbFastestProperties();
|
||||||
public SqliteFastBuilder(EntityInfo entityInfo)
|
public SqliteFastBuilder(EntityInfo entityInfo)
|
||||||
{
|
{
|
||||||
this.entityInfo = entityInfo;
|
this.entityInfo = entityInfo;
|
||||||
|
Reference in New Issue
Block a user