mirror of
https://github.com/nsnail/ns-ext.git
synced 2025-04-20 01:22:51 +08:00
<fix>
This commit is contained in:
parent
8c1083f732
commit
f3d0f98970
@ -15,29 +15,17 @@ public static class DbCommandExtensions
|
||||
|
||||
//应逆向替换,否则由于 多个表的过滤器问题导致替换不完整 如 @TenantId1 @TenantId10
|
||||
for (var i = me.Parameters.Count - 1; i >= 0; i--) {
|
||||
#pragma warning disable IDE0072
|
||||
sql = me.Parameters[i].DbType switch {
|
||||
#pragma warning restore IDE0072
|
||||
DbType.String or DbType.DateTime or DbType.Date or DbType.Time or DbType.DateTime2
|
||||
or DbType.DateTimeOffset or DbType.Guid or DbType.VarNumeric or DbType.AnsiStringFixedLength
|
||||
or DbType.AnsiString or DbType.StringFixedLength => sql.Replace( //
|
||||
me.Parameters[i].ParameterName, "'" + me.Parameters[i].Value + "'")
|
||||
, DbType.Boolean => sql.Replace( //
|
||||
or DbType.AnsiString
|
||||
or DbType.StringFixedLength =>
|
||||
sql.Replace(me.Parameters[i].ParameterName, "'" + me.Parameters[i].Value + "'")
|
||||
, DbType.Boolean => sql.Replace(//
|
||||
me.Parameters[i].ParameterName
|
||||
, Convert.ToBoolean(me.Parameters[i].Value, CultureInfo.InvariantCulture) ? "1" : "0")
|
||||
, DbType.Binary => throw new NotImplementedException()
|
||||
, DbType.Byte => throw new NotImplementedException()
|
||||
, DbType.Currency => throw new NotImplementedException()
|
||||
, DbType.Decimal => throw new NotImplementedException()
|
||||
, DbType.Double => throw new NotImplementedException()
|
||||
, DbType.Int16 => throw new NotImplementedException()
|
||||
, DbType.Int32 => throw new NotImplementedException()
|
||||
, DbType.Int64 => throw new NotImplementedException()
|
||||
, DbType.Object => throw new NotImplementedException()
|
||||
, DbType.SByte => throw new NotImplementedException()
|
||||
, DbType.Single => throw new NotImplementedException()
|
||||
, DbType.UInt16 => throw new NotImplementedException()
|
||||
, DbType.UInt32 => throw new NotImplementedException()
|
||||
, DbType.UInt64 => throw new NotImplementedException()
|
||||
, DbType.Xml => throw new NotImplementedException()
|
||||
, _ => sql.Replace(me.Parameters[i].ParameterName, me.Parameters[i].Value?.ToString())
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user