|
@ -263,6 +263,7 @@ namespace SqlSugar |
|
|
} |
|
|
} |
|
|
public virtual IInsertable<T> Insertable<T>(Dictionary<string, object> columnDictionary) where T : class, new() |
|
|
public virtual IInsertable<T> Insertable<T>(Dictionary<string, object> columnDictionary) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null"); |
|
|
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null"); |
|
|
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary)); |
|
|
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary)); |
|
|
var columns = columnDictionary.Select(it => it.Key).ToList(); |
|
|
var columns = columnDictionary.Select(it => it.Key).ToList(); |
|
@ -270,6 +271,7 @@ namespace SqlSugar |
|
|
} |
|
|
} |
|
|
public virtual IInsertable<T> Insertable<T>(dynamic insertDynamicObject) where T : class, new() |
|
|
public virtual IInsertable<T> Insertable<T>(dynamic insertDynamicObject) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
if (insertDynamicObject is T) |
|
|
if (insertDynamicObject is T) |
|
|
{ |
|
|
{ |
|
|
return this.Insertable((T)insertDynamicObject); |
|
|
return this.Insertable((T)insertDynamicObject); |
|
@ -293,26 +295,32 @@ namespace SqlSugar |
|
|
} |
|
|
} |
|
|
public virtual IDeleteable<T> Deleteable<T>(Expression<Func<T, bool>> expression) where T : class, new() |
|
|
public virtual IDeleteable<T> Deleteable<T>(Expression<Func<T, bool>> expression) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
return this.Deleteable<T>().Where(expression); |
|
|
return this.Deleteable<T>().Where(expression); |
|
|
} |
|
|
} |
|
|
public virtual IDeleteable<T> Deleteable<T>(dynamic primaryKeyValue) where T : class, new() |
|
|
public virtual IDeleteable<T> Deleteable<T>(dynamic primaryKeyValue) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
return this.Deleteable<T>().In(primaryKeyValue); |
|
|
return this.Deleteable<T>().In(primaryKeyValue); |
|
|
} |
|
|
} |
|
|
public virtual IDeleteable<T> Deleteable<T>(dynamic[] primaryKeyValues) where T : class, new() |
|
|
public virtual IDeleteable<T> Deleteable<T>(dynamic[] primaryKeyValues) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
return this.Deleteable<T>().In(primaryKeyValues); |
|
|
return this.Deleteable<T>().In(primaryKeyValues); |
|
|
} |
|
|
} |
|
|
public virtual IDeleteable<T> Deleteable<T>(List<dynamic> pkValue) where T : class, new() |
|
|
public virtual IDeleteable<T> Deleteable<T>(List<dynamic> pkValue) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
return this.Deleteable<T>().In(pkValue); |
|
|
return this.Deleteable<T>().In(pkValue); |
|
|
} |
|
|
} |
|
|
public virtual IDeleteable<T> Deleteable<T>(T deleteObj) where T : class, new() |
|
|
public virtual IDeleteable<T> Deleteable<T>(T deleteObj) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
return this.Deleteable<T>().Where(deleteObj); |
|
|
return this.Deleteable<T>().Where(deleteObj); |
|
|
} |
|
|
} |
|
|
public virtual IDeleteable<T> Deleteable<T>(List<T> deleteObjs) where T : class, new() |
|
|
public virtual IDeleteable<T> Deleteable<T>(List<T> deleteObjs) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
return this.Deleteable<T>().Where(deleteObjs); |
|
|
return this.Deleteable<T>().Where(deleteObjs); |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
@ -339,6 +347,7 @@ namespace SqlSugar |
|
|
} |
|
|
} |
|
|
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new() |
|
|
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null"); |
|
|
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null"); |
|
|
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary)); |
|
|
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary)); |
|
|
var columns = columnDictionary.Select(it => it.Key).ToList(); |
|
|
var columns = columnDictionary.Select(it => it.Key).ToList(); |
|
@ -346,6 +355,7 @@ namespace SqlSugar |
|
|
} |
|
|
} |
|
|
public virtual IUpdateable<T> Updateable<T>(dynamic updateDynamicObject) where T : class, new() |
|
|
public virtual IUpdateable<T> Updateable<T>(dynamic updateDynamicObject) where T : class, new() |
|
|
{ |
|
|
{ |
|
|
|
|
|
InitMppingInfo<T>(); |
|
|
if (updateDynamicObject is T) |
|
|
if (updateDynamicObject is T) |
|
|
{ |
|
|
{ |
|
|
return this.Updateable((T)updateDynamicObject); |
|
|
return this.Updateable((T)updateDynamicObject); |
|
|