本文整理汇总了C#中ICriteriaQuery.GetSQLAlias方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteriaQuery.GetSQLAlias方法的具体用法?C# ICriteriaQuery.GetSQLAlias怎么用?C# ICriteriaQuery.GetSQLAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteriaQuery
的用法示例。
在下文中一共展示了ICriteriaQuery.GetSQLAlias方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSqlString
public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery)
{
//SqlString result = new SqlString(criteriaQuery.GetSQLAlias(criteria));
//result.Replace(sql, "{alias}");
//return result;
return new SqlString(StringHelper.Replace(sql, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
}
示例2: ToSqlString
public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
string entityName = criteriaQuery.GetEntityName(criteria, propertyName);
string actualPropertyName = criteriaQuery.GetPropertyName(propertyName);
string sqlAlias = criteriaQuery.GetSQLAlias(criteria, propertyName);
ISessionFactoryImplementor factory = criteriaQuery.Factory;
IQueryableCollection collectionPersister = GetQueryableCollection(entityName, actualPropertyName, factory);
string[] collectionKeys = collectionPersister.KeyColumnNames;
string[] ownerKeys = ((ILoadable)factory.GetEntityPersister(entityName)).IdentifierColumnNames;
StringBuilder innerSelect = new StringBuilder();
innerSelect.Append("(select 1 from ")
.Append(collectionPersister.TableName)
.Append(" where ")
.Append(
new ConditionalFragment().SetTableAlias(sqlAlias).SetCondition(ownerKeys, collectionKeys).ToSqlStringFragment());
if (collectionPersister.HasWhere)
{
innerSelect.Append(" and (")
.Append(collectionPersister.GetSQLWhereString(collectionPersister.TableName))
.Append(") ");
}
innerSelect.Append(")");
return new SqlString(new string[] {ExcludeEmpty ? "exists" : "not exists", innerSelect.ToString()});
}
示例3: ToSqlString
public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
//SqlString result = new SqlString(criteriaQuery.GetSQLAlias(criteria));
//result.Replace(sql, "{alias}");
//return result;
return new SqlString(StringHelper.Replace(sql, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
}
示例4: ToSqlString
public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
var parameters = _sql.GetParameters().ToList();
var paramPos = 0;
for (int i = 0; i < _typedValues.Length; i++)
{
var controlledParameters = criteriaQuery.NewQueryParameter(_typedValues[i]);
foreach (Parameter parameter in controlledParameters)
{
parameters[paramPos++].BackTrack = parameter.BackTrack;
}
}
return _sql.Replace("{alias}", criteriaQuery.GetSQLAlias(criteria));
}
示例5: ToGroupSqlString
public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
return new SqlString(StringHelper.Replace(groupBy, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
}
示例6: 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();
}
示例7: ToSqlString
public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
{
return _sql.Replace("{alias}", criteriaQuery.GetSQLAlias(criteria));
}
示例8: ToSqlString
public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery,
IDictionary<string, IFilter> enabledFilters)
{
return new SqlString(StringHelper.Replace(this.sql, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
}
示例9: ToGroupSqlString
public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
{
return new SqlString(StringHelper.Replace(groupBy, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
}