This commit is contained in:
sunkaixuan 2019-05-19 11:12:14 +08:00
parent d1c6c2816b
commit f522b95cfc

View File

@ -248,32 +248,6 @@ namespace SqlSugar
return Task.FromResult(UseTran(action, errorCallBack)); return Task.FromResult(UseTran(action, errorCallBack));
} }
public void UseStoredProcedure(Action action)
{
var oldCommandType = this.CommandType;
this.CommandType = CommandType.StoredProcedure;
this.IsClearParameters = false;
if (action != null)
{
action();
}
this.CommandType = oldCommandType;
this.IsClearParameters = true;
}
public T UseStoredProcedure<T>(Func<T> action)
{
T result = default(T);
var oldCommandType = this.CommandType;
this.CommandType = CommandType.StoredProcedure;
this.IsClearParameters = false;
if (action != null)
{
result = action();
}
this.CommandType = oldCommandType;
this.IsClearParameters = true;
return result;
}
public IAdo UseStoredProcedure() public IAdo UseStoredProcedure()
{ {
this.OldCommandType = this.CommandType; this.OldCommandType = this.CommandType;
@ -1731,6 +1705,34 @@ namespace SqlSugar
var dt = this.GetDataTable(sql, parameters); var dt = this.GetDataTable(sql, parameters);
return dt == null ? null : this.Context.Utilities.DataTableToDynamic(dt); return dt == null ? null : this.Context.Utilities.DataTableToDynamic(dt);
} }
[Obsolete]
public void UseStoredProcedure(Action action)
{
var oldCommandType = this.CommandType;
this.CommandType = CommandType.StoredProcedure;
this.IsClearParameters = false;
if (action != null)
{
action();
}
this.CommandType = oldCommandType;
this.IsClearParameters = true;
}
[Obsolete]
public T UseStoredProcedure<T>(Func<T> action)
{
T result = default(T);
var oldCommandType = this.CommandType;
this.CommandType = CommandType.StoredProcedure;
this.IsClearParameters = false;
if (action != null)
{
result = action();
}
this.CommandType = oldCommandType;
this.IsClearParameters = true;
return result;
}
#endregion #endregion
} }
} }