本文整理汇总了C#中NHibernate.Engine.QueryParameters.FindAdjustedParameterLocation方法的典型用法代码示例。如果您正苦于以下问题:C# QueryParameters.FindAdjustedParameterLocation方法的具体用法?C# QueryParameters.FindAdjustedParameterLocation怎么用?C# QueryParameters.FindAdjustedParameterLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NHibernate.Engine.QueryParameters
的用法示例。
在下文中一共展示了QueryParameters.FindAdjustedParameterLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParameterTypes
/// <returns><see cref="IList" /> of <see cref="IType" /></returns>
protected SqlType[] GetParameterTypes(QueryParameters parameters, bool addLimit, bool addOffset)
{
List<IType> paramTypeList = new List<IType>();
int span = 0;
for (int index = 0; index < parameters.PositionalParameterTypes.Length; index++)
{
int location = parameters.PositionalParameterLocations[index];
location = parameters.FindAdjustedParameterLocation(location);
IType type = parameters.PositionalParameterTypes[index];
ArrayHelper.SafeSetValue(paramTypeList, location, type);
span += type.GetColumnSpan(Factory);
}
for (int index = 0; index < parameters.FilteredParameterTypes.Count; index++)
{
int location = parameters.FilteredParameterLocations[index];
IType type = parameters.FilteredParameterTypes[index];
ArrayHelper.SafeSetValue(paramTypeList, location, type);
span += type.GetColumnSpan(Factory);
}
if (parameters.NamedParameters != null && parameters.NamedParameters.Count > 0)
{
// convert the named parameters to an array of types
foreach (KeyValuePair<string, TypedValue> namedParameter in parameters.NamedParameters)
{
string name = namedParameter.Key;
TypedValue typedval = namedParameter.Value;
int[] locs = GetNamedParameterLocs(name);
span += typedval.Type.GetColumnSpan(Factory) * locs.Length;
for (int i = 0; i < locs.Length; i++)
{
int location = locs[i];
location = parameters.FindAdjustedParameterLocation(location);
// can still clash with positional parameters
// could consider throwing an exception to locate problem (NH-1098)
while ((location < paramTypeList.Count) && (paramTypeList[location] != null))
location++;
ArrayHelper.SafeSetValue(paramTypeList, location, typedval.Type);
}
}
}
if (addLimit && Factory.Dialect.SupportsVariableLimit)
{
if (Factory.Dialect.BindLimitParametersFirst)
{
paramTypeList.Insert(0, NHibernateUtil.Int32);
if (addOffset)
{
paramTypeList.Insert(0, NHibernateUtil.Int32);
}
}
else
{
paramTypeList.Add(NHibernateUtil.Int32);
if (addOffset)
{
paramTypeList.Add(NHibernateUtil.Int32);
}
}
span += addOffset ? 2 : 1;
}
return ConvertITypesToSqlTypes(paramTypeList, span);
}