本文整理汇总了C#中ICriteriaQuery.GetPropertyName方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteriaQuery.GetPropertyName方法的具体用法?C# ICriteriaQuery.GetPropertyName怎么用?C# ICriteriaQuery.GetPropertyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteriaQuery
的用法示例。
在下文中一共展示了ICriteriaQuery.GetPropertyName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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()});
}