Update .net core project

This commit is contained in:
sunkaixuan 2022-06-14 19:01:35 +08:00
parent 3e4ede5f2a
commit f02e9a3ea9
3 changed files with 26 additions and 1 deletions

View File

@ -136,8 +136,11 @@ namespace SqlSugar
else if (type!=null&&type.IsEnum())
{
this.DbType = System.Data.DbType.Int64;
if (Value != null)
{
this.Value = Convert.ToInt64(Value);
}
}
else if (type==UtilConstants.UIntType)
{
this.DbType = System.Data.DbType.UInt32;

View File

@ -36,6 +36,8 @@ namespace SqlSugar
T GetSingle(Expression<Func<T, bool>> whereExpression);
T GetFirst(Expression<Func<T, bool>> whereExpression);
bool Insert(T insertObj);
bool InsertOrUpdate(T data);
bool InsertOrUpdate(List<T> datas);
bool InsertRange(List<T> insertObjs);
bool InsertRange(T[] insertObjs);
int InsertReturnIdentity(T insertObj);
@ -69,6 +71,8 @@ namespace SqlSugar
Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
Task<bool> InsertAsync(T insertObj);
Task<bool> InsertOrUpdateAsync(T data);
Task<bool> InsertOrUpdateAsync(List<T> datas);
Task<bool> InsertRangeAsync(List<T> insertObjs);
Task<bool> InsertRangeAsync(T[] insertObjs);
Task<int> InsertReturnIdentityAsync(T insertObj);

View File

@ -148,6 +148,16 @@ namespace SqlSugar
{
return this.Context.Insertable(insertObj).ExecuteCommand() > 0;
}
public virtual bool InsertOrUpdate(T data)
{
return this.Context.Storageable(data).ExecuteCommand() > 0;
}
public virtual bool InsertOrUpdate(List<T> datas)
{
return this.Context.Storageable(datas).ExecuteCommand() > 0;
}
public virtual int InsertReturnIdentity(T insertObj)
{
return this.Context.Insertable(insertObj).ExecuteReturnIdentity();
@ -278,6 +288,14 @@ namespace SqlSugar
return Context.Queryable<T>().Where(whereExpression).CountAsync();
}
public virtual async Task<bool> InsertOrUpdateAsync(T data)
{
return await this.Context.Storageable(data).ExecuteCommandAsync() > 0;
}
public virtual async Task<bool> InsertOrUpdateAsync(List<T> datas)
{
return await this.Context.Storageable(datas).ExecuteCommandAsync() > 0;
}
public virtual async Task<bool> InsertAsync(T insertObj)
{
return await this.Context.Insertable(insertObj).ExecuteCommandAsync() > 0;