本文整理汇总了C#中ISessionImplementor.GetFilterParameterValue方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionImplementor.GetFilterParameterValue方法的具体用法?C# ISessionImplementor.GetFilterParameterValue怎么用?C# ISessionImplementor.GetFilterParameterValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionImplementor
的用法示例。
在下文中一共展示了ISessionImplementor.GetFilterParameterValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bind
public void Bind(IDbCommand command, IList<Parameter> multiSqlQueryParametersList, int singleSqlParametersOffset, IList<Parameter> sqlQueryParametersList, QueryParameters queryParameters, ISessionImplementor session)
{
string backTrackId = GetIdsForBackTrack(session.Factory).First(); // just the first because IType suppose the oders in certain sequence
// The same filterName-parameterName can appear more than once in the whole query
object value = session.GetFilterParameterValue(filterParameterFullName);
foreach (int position in multiSqlQueryParametersList.GetEffectiveParameterLocations(backTrackId))
{
ExpectedType.NullSafeSet(command, value, position, session);
}
}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:11,代码来源:DynamicFilterParameterSpecification.cs
示例2: Bind
public int Bind(IDbCommand statement, QueryParameters qp, ISessionImplementor session, int start)
{
int columnSpan = _definedParameterType.GetColumnSpan(session.Factory);
object value = session.GetFilterParameterValue(_filterName + '.' + _parameterName);
if (value is ICollection && !value.GetType().IsArray)
{
int positions = 0;
foreach (var entry in (ICollection)value)
{
_definedParameterType.NullSafeSet(statement, entry, start + positions, session);
positions += columnSpan;
}
return positions;
}
else
{
_definedParameterType.NullSafeSet(statement, value, start, session);
return columnSpan;
}
}
示例3: ProcessFilters
public void ProcessFilters(SqlString sql, ISessionImplementor session)
{
filteredParameterValues = new List<object>();
filteredParameterTypes = new List<IType>();
filteredParameterLocations = new List<int>();
if (session.EnabledFilters.Count == 0 || sql.ToString().IndexOf(ParserHelper.HqlVariablePrefix) < 0)
{
processedSQL = sql.Copy();
return;
}
Dialect.Dialect dialect = session.Factory.Dialect;
string symbols = ParserHelper.HqlSeparators + dialect.OpenQuote + dialect.CloseQuote;
var result = new SqlStringBuilder();
int originalParameterIndex = 0; // keep track of the positional parameter
int newParameterIndex = 0;
_adjustedParameterLocations = new Dictionary<int, int>();
foreach (var part in sql.Parts)
{
if (part is Parameter)
{
result.AddParameter();
// (?) can be a position parameter or a named parameter (already substituted by (?),
// but only the positional parameters are available at this point. Adding them in the
// order of appearance is best that can be done at this point of time, but if they
// are mixed with named parameters, the order is still wrong, because values and
// types for the named parameters are added later to the end of the list.
// see test fixture NH-1098
_adjustedParameterLocations[originalParameterIndex] = newParameterIndex;
originalParameterIndex++;
newParameterIndex++;
continue;
}
var tokenizer = new StringTokenizer((string) part, symbols, true);
foreach (var token in tokenizer)
{
if (token.StartsWith(ParserHelper.HqlVariablePrefix))
{
string filterParameterName = token.Substring(1);
object value = session.GetFilterParameterValue(filterParameterName);
IType type = session.GetFilterParameterType(filterParameterName);
// If the value is not a value of the type but a collection of values...
if (value != null && !type.ReturnedClass.IsAssignableFrom(value.GetType()) && // Added to fix NH-882
typeof (ICollection).IsAssignableFrom(value.GetType()))
{
var coll = (ICollection) value;
int i = 0;
foreach (var elementValue in coll)
{
i++;
int span = type.GetColumnSpan(session.Factory);
if (span > 0)
{
result.AddParameter();
filteredParameterTypes.Add(type);
filteredParameterValues.Add(elementValue);
filteredParameterLocations.Add(newParameterIndex);
newParameterIndex++;
if (i < coll.Count)
{
result.Add(", ");
}
}
}
}
else
{
int span = type.GetColumnSpan(session.Factory);
if (span > 0)
{
result.AddParameter();
filteredParameterTypes.Add(type);
filteredParameterValues.Add(value);
filteredParameterLocations.Add(newParameterIndex);
newParameterIndex++;
}
}
}
else
{
result.Add(token);
}
}
}
processedSQL = result.ToSqlString();
}