本文整理匯總了C#中NHibernate.Collection.List.Insert方法的典型用法代碼示例。如果您正苦於以下問題:C# List.Insert方法的具體用法?C# List.Insert怎麽用?C# List.Insert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NHibernate.Collection.List
的用法示例。
在下文中一共展示了List.Insert方法的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);
}