mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Insert update add dictionary Or dynamic Overloading of functions
This commit is contained in:
parent
f1a4a9e695
commit
e7a061b052
@ -261,6 +261,24 @@ namespace SqlSugar
|
||||
{
|
||||
return this.Insertable(new T[] { insertObj });
|
||||
}
|
||||
public virtual IInsertable<T> Insertable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
|
||||
{
|
||||
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Insertable.columnDictionary can't be null");
|
||||
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary));
|
||||
return this.Insertable(insertObject);
|
||||
}
|
||||
public virtual IInsertable<T> Insertable<T>(dynamic insertDynamicObject) where T : class, new()
|
||||
{
|
||||
if (insertDynamicObject is T)
|
||||
{
|
||||
return this.Insertable((T)insertDynamicObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
var insertObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(insertDynamicObject));
|
||||
return this.Insertable(insertObject);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Deleteable
|
||||
@ -316,6 +334,24 @@ namespace SqlSugar
|
||||
{
|
||||
return this.Updateable(new T[] { new T() });
|
||||
}
|
||||
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
|
||||
{
|
||||
Check.Exception(columnDictionary == null || columnDictionary.Count == 0, "Updateable.columnDictionary can't be null");
|
||||
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(columnDictionary));
|
||||
return this.Updateable(updateObject);
|
||||
}
|
||||
public virtual IUpdateable<T> Updateable<T>(dynamic updateDynamicObject) where T : class, new()
|
||||
{
|
||||
if (updateDynamicObject is T)
|
||||
{
|
||||
return this.Updateable((T)updateDynamicObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
var updateObject = this.RewritableMethods.DeserializeObject<T>(this.RewritableMethods.SerializeObject(updateDynamicObject));
|
||||
return this.Updateable(updateObject);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DbFirst
|
||||
|
Loading…
Reference in New Issue
Block a user