1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace BllSql
|
||||
{
|
||||
// Token: 0x02000004 RID: 4
|
||||
public sealed class SqlHelperParameterCache
|
||||
{
|
||||
// Token: 0x06000050 RID: 80 RVA: 0x000020A9 File Offset: 0x000002A9
|
||||
private SqlHelperParameterCache()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000051 RID: 81 RVA: 0x000041DC File Offset: 0x000023DC
|
||||
private static SqlParameter[] DiscoverSpParameterSet(SqlConnection connection, string spName, bool includeReturnValueParameter)
|
||||
{
|
||||
bool flag = connection == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentNullException("connection");
|
||||
}
|
||||
bool flag2 = spName == null || spName.Length == 0;
|
||||
if (flag2)
|
||||
{
|
||||
throw new ArgumentNullException("spName");
|
||||
}
|
||||
SqlCommand cmd = new SqlCommand(spName, connection);
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
connection.Open();
|
||||
SqlCommandBuilder.DeriveParameters(cmd);
|
||||
connection.Close();
|
||||
bool flag3 = !includeReturnValueParameter;
|
||||
if (flag3)
|
||||
{
|
||||
cmd.Parameters.RemoveAt(0);
|
||||
}
|
||||
SqlParameter[] discoveredParameters = new SqlParameter[cmd.Parameters.Count];
|
||||
cmd.Parameters.CopyTo(discoveredParameters, 0);
|
||||
foreach (SqlParameter discoveredParameter in discoveredParameters)
|
||||
{
|
||||
discoveredParameter.Value = DBNull.Value;
|
||||
}
|
||||
return discoveredParameters;
|
||||
}
|
||||
|
||||
// Token: 0x06000052 RID: 82 RVA: 0x000042AC File Offset: 0x000024AC
|
||||
private static SqlParameter[] CloneParameters(SqlParameter[] originalParameters)
|
||||
{
|
||||
SqlParameter[] clonedParameters = new SqlParameter[originalParameters.Length];
|
||||
int i = 0;
|
||||
int j = originalParameters.Length;
|
||||
while (i < j)
|
||||
{
|
||||
clonedParameters[i] = (SqlParameter)((ICloneable)originalParameters[i]).Clone();
|
||||
i++;
|
||||
}
|
||||
return clonedParameters;
|
||||
}
|
||||
|
||||
// Token: 0x06000053 RID: 83 RVA: 0x000042F0 File Offset: 0x000024F0
|
||||
public static void CacheParameterSet(string connectionString, string commandText, params SqlParameter[] commandParameters)
|
||||
{
|
||||
bool flag = connectionString == null || connectionString.Length == 0;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentNullException("connectionString");
|
||||
}
|
||||
bool flag2 = commandText == null || commandText.Length == 0;
|
||||
if (flag2)
|
||||
{
|
||||
throw new ArgumentNullException("commandText");
|
||||
}
|
||||
string hashKey = connectionString + ":" + commandText;
|
||||
SqlHelperParameterCache.paramCache[hashKey] = commandParameters;
|
||||
}
|
||||
|
||||
// Token: 0x06000054 RID: 84 RVA: 0x00004354 File Offset: 0x00002554
|
||||
public static SqlParameter[] GetCachedParameterSet(string connectionString, string commandText)
|
||||
{
|
||||
bool flag = connectionString == null || connectionString.Length == 0;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentNullException("connectionString");
|
||||
}
|
||||
bool flag2 = commandText == null || commandText.Length == 0;
|
||||
if (flag2)
|
||||
{
|
||||
throw new ArgumentNullException("commandText");
|
||||
}
|
||||
string hashKey = connectionString + ":" + commandText;
|
||||
SqlParameter[] cachedParameters = SqlHelperParameterCache.paramCache[hashKey] as SqlParameter[];
|
||||
bool flag3 = cachedParameters == null;
|
||||
SqlParameter[] result;
|
||||
if (flag3)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = SqlHelperParameterCache.CloneParameters(cachedParameters);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000055 RID: 85 RVA: 0x000043DC File Offset: 0x000025DC
|
||||
public static SqlParameter[] GetSpParameterSet(string connectionString, string spName)
|
||||
{
|
||||
return SqlHelperParameterCache.GetSpParameterSet(connectionString, spName, false);
|
||||
}
|
||||
|
||||
// Token: 0x06000056 RID: 86 RVA: 0x000043F8 File Offset: 0x000025F8
|
||||
public static SqlParameter[] GetSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter)
|
||||
{
|
||||
bool flag = connectionString == null || connectionString.Length == 0;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentNullException("connectionString");
|
||||
}
|
||||
bool flag2 = spName == null || spName.Length == 0;
|
||||
if (flag2)
|
||||
{
|
||||
throw new ArgumentNullException("spName");
|
||||
}
|
||||
SqlParameter[] spParameterSetInternal;
|
||||
using (SqlConnection connection = new SqlConnection(connectionString))
|
||||
{
|
||||
spParameterSetInternal = SqlHelperParameterCache.GetSpParameterSetInternal(connection, spName, includeReturnValueParameter);
|
||||
}
|
||||
return spParameterSetInternal;
|
||||
}
|
||||
|
||||
// Token: 0x06000057 RID: 87 RVA: 0x00004474 File Offset: 0x00002674
|
||||
internal static SqlParameter[] GetSpParameterSet(SqlConnection connection, string spName)
|
||||
{
|
||||
return SqlHelperParameterCache.GetSpParameterSet(connection, spName, false);
|
||||
}
|
||||
|
||||
// Token: 0x06000058 RID: 88 RVA: 0x00004490 File Offset: 0x00002690
|
||||
internal static SqlParameter[] GetSpParameterSet(SqlConnection connection, string spName, bool includeReturnValueParameter)
|
||||
{
|
||||
bool flag = connection == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentNullException("connection");
|
||||
}
|
||||
SqlParameter[] spParameterSetInternal;
|
||||
using (SqlConnection clonedConnection = (SqlConnection)((ICloneable)connection).Clone())
|
||||
{
|
||||
spParameterSetInternal = SqlHelperParameterCache.GetSpParameterSetInternal(clonedConnection, spName, includeReturnValueParameter);
|
||||
}
|
||||
return spParameterSetInternal;
|
||||
}
|
||||
|
||||
// Token: 0x06000059 RID: 89 RVA: 0x000044E8 File Offset: 0x000026E8
|
||||
private static SqlParameter[] GetSpParameterSetInternal(SqlConnection connection, string spName, bool includeReturnValueParameter)
|
||||
{
|
||||
bool flag = connection == null;
|
||||
if (flag)
|
||||
{
|
||||
throw new ArgumentNullException("connection");
|
||||
}
|
||||
bool flag2 = spName == null || spName.Length == 0;
|
||||
if (flag2)
|
||||
{
|
||||
throw new ArgumentNullException("spName");
|
||||
}
|
||||
string hashKey = connection.ConnectionString + ":" + spName + (includeReturnValueParameter ? ":include ReturnValue Parameter" : "");
|
||||
SqlParameter[] cachedParameters = SqlHelperParameterCache.paramCache[hashKey] as SqlParameter[];
|
||||
bool flag3 = cachedParameters == null;
|
||||
if (flag3)
|
||||
{
|
||||
SqlParameter[] spParameters = SqlHelperParameterCache.DiscoverSpParameterSet(connection, spName, includeReturnValueParameter);
|
||||
SqlHelperParameterCache.paramCache[hashKey] = spParameters;
|
||||
cachedParameters = spParameters;
|
||||
}
|
||||
return SqlHelperParameterCache.CloneParameters(cachedParameters);
|
||||
}
|
||||
|
||||
// Token: 0x04000001 RID: 1
|
||||
private static Hashtable paramCache = Hashtable.Synchronized(new Hashtable());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user