本文整理汇总了C#中ICriteriaQuery.GetIdentifierColumns方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteriaQuery.GetIdentifierColumns方法的具体用法?C# ICriteriaQuery.GetIdentifierColumns怎么用?C# ICriteriaQuery.GetIdentifierColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteriaQuery
的用法示例。
在下文中一共展示了ICriteriaQuery.GetIdentifierColumns方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSqlString
public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
//Implementation changed from H3.2 to use SqlString
string[] columns = criteriaQuery.GetIdentifierColumns(criteria);
SqlStringBuilder result = new SqlStringBuilder(4 * columns.Length + 2);
if (columns.Length > 1)
{
result.Add(StringHelper.OpenParen);
}
for (int i = 0; i < columns.Length; i++)
{
if (i > 0)
{
result.Add(" and ");
}
result.Add(columns[i])
.Add(" = ");
AddValueOrProjection(criteria, criteriaQuery, enabledFilters, result);
}
if (columns.Length > 1)
{
result.Add(StringHelper.ClosedParen);
}
return result.ToSqlString();
}
示例2: ToGroupSqlString
public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
if (!grouped)
{
throw new InvalidOperationException("not a grouping projection");
}
return new SqlString(StringHelper.Join(",", criteriaQuery.GetIdentifierColumns(criteria)));
}
示例3: ToSqlString
public override SqlString ToSqlString(ICriteria criteria, int position, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
SqlStringBuilder buf = new SqlStringBuilder();
string[] cols = criteriaQuery.GetIdentifierColumns(criteria);
for (int i = 0; i < cols.Length; i++)
{
if (i > 0)
{
buf.Add(", ");
}
buf.Add(cols[i])
.Add(" as y")
.Add((position + i).ToString())
.Add("_");
}
return buf.ToSqlString();
}
示例4: ToSqlString
/// <summary>
/// Render a SqlString for the expression.
/// </summary>
/// <param name="criteria"></param>
/// <param name="criteriaQuery"></param>
/// <param name="enabledFilters"></param>
/// <returns>
/// A SqlString that contains a valid Sql fragment.
/// </returns>
public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
//criteriaQuery.AddUsedTypedValues(GetTypedValues(criteria, criteriaQuery));
ISpatialDialect spatialDialect = (ISpatialDialect)criteriaQuery.Factory.Dialect;
string[] columnsUsingProjection = criteriaQuery.GetColumnsUsingProjection(criteria, this.propertyName);
IType typeUsingProjection = criteriaQuery.GetTypeUsingProjection(criteria, this.propertyName);
if (typeUsingProjection.IsCollectionType)
{
throw new QueryException(string.Format("cannot use collection property ({0}.{1}) directly in a criterion, use ICriteria.CreateCriteria instead", criteriaQuery.GetEntityName(criteria), this.propertyName));
}
string[] keyColumns = criteriaQuery.GetIdentifierColumns(criteria);
string entityType = criteriaQuery.GetEntityName(criteria, this.propertyName);
AbstractEntityPersister entityPersister = (AbstractEntityPersister)criteriaQuery.Factory.GetEntityPersister(entityType);
// Only one key column is assumed
string keyColumn = keyColumns[0];
string alias = criteriaQuery.GetSQLAlias(criteria, this.propertyName);
string tableName = entityPersister.TableName;
int aliasLength = alias.Length + 1;
SqlStringBuilder builder = new SqlStringBuilder(10 * columnsUsingProjection.Length);
for (int i = 0; i < columnsUsingProjection.Length; i++)
{
if (i > 0)
{
builder.Add(" AND ");
}
string geometryColumn = columnsUsingProjection[i].Remove(0, aliasLength);
builder.Add(spatialDialect.GetSpatialFilterString(alias, geometryColumn, keyColumn, tableName));
}
return builder.ToSqlString();
}
示例5: ToGroupSqlString
public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
return (grouped) ?
new SqlString(StringHelper.Join(",", criteriaQuery.GetIdentifierColumns(criteria)))
: base.ToGroupSqlString(criteria, criteriaQuery,enabledFilters);
}
示例6: ToGroupSqlString
public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
{
return (grouped) ?
new SqlString(StringHelper.Join(",", criteriaQuery.GetIdentifierColumns(criteria)))
: base.ToGroupSqlString(criteria, criteriaQuery);
}