本文整理汇总了C#中IJoinable.ConsumesEntityAlias方法的典型用法代码示例。如果您正苦于以下问题:C# IJoinable.ConsumesEntityAlias方法的具体用法?C# IJoinable.ConsumesEntityAlias怎么用?C# IJoinable.ConsumesEntityAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IJoinable
的用法示例。
在下文中一共展示了IJoinable.ConsumesEntityAlias方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateTableAlias
protected override string GenerateTableAlias(int n, string path, IJoinable joinable)
{
if (joinable.ConsumesEntityAlias())
{
ICriteria subcriteria = translator.GetCriteria(path);
String sqlAlias = subcriteria == null ? null : translator.GetSQLAlias(subcriteria);
if (sqlAlias != null)
{
userAliasList.Add(subcriteria.Alias); //alias may be null
return sqlAlias; //EARLY EXIT
}
else
{
userAliasList.Add(null);
}
}
return base.GenerateTableAlias(n + translator.SQLAliasCount, path, joinable);
}
示例2: GenerateTableAlias
protected override string GenerateTableAlias(int n, string path, IJoinable joinable)
{
// TODO: deal with side-effects (changes to includeInSelectList, userAliasList, resultTypeList)!!!
bool shouldCreateUserAlias = joinable.ConsumesEntityAlias();
if(shouldCreateUserAlias == false && joinable.IsCollection)
{
var elementType = ((ICollectionPersister)joinable).ElementType;
if (elementType != null)
shouldCreateUserAlias = elementType.IsComponentType;
}
if (shouldCreateUserAlias)
{
ICriteria subcriteria = translator.GetCriteria(path);
string sqlAlias = subcriteria == null ? null : translator.GetSQLAlias(subcriteria);
if (sqlAlias != null)
{
if (!translator.HasProjection)
{
includeInResultRowList.Add(subcriteria.Alias != null);
if (subcriteria.Alias!=null)
{
userAliasList.Add(subcriteria.Alias); //alias may be null
resultTypeList.Add(translator.ResultType(subcriteria));
}
}
return sqlAlias; //EARLY EXIT
}
else
{
if (!translator.HasProjection)
includeInResultRowList.Add(false);
}
}
return base.GenerateTableAlias(n + translator.SQLAliasCount, path, joinable);
}
示例3: GenerateTableAlias
protected override string GenerateTableAlias(int n, string path, IJoinable joinable)
{
bool shouldCreateUserAlias = joinable.ConsumesEntityAlias();
if(shouldCreateUserAlias == false && joinable.IsCollection)
{
var elementType = ((ICollectionPersister)joinable).ElementType;
if (elementType != null)
shouldCreateUserAlias = elementType.IsComponentType;
}
if (shouldCreateUserAlias)
{
ICriteria subcriteria = translator.GetCriteria(path);
string sqlAlias = subcriteria == null ? null : translator.GetSQLAlias(subcriteria);
if (sqlAlias != null)
{
userAliasList.Add(subcriteria.Alias); //alias may be null
return sqlAlias; //EARLY EXIT
}
userAliasList.Add(null);
}
return base.GenerateTableAlias(n + translator.SQLAliasCount, path, joinable);
}
示例4: GenerateTableAlias
protected override string GenerateTableAlias(int n, string path, IJoinable joinable)
{
// TODO: deal with side-effects (changes to includeInSelectList, userAliasList, resultTypeList)!!!
// for collection-of-entity, we are called twice for given "path"
// once for the collection Joinable, once for the entity Joinable.
// the second call will/must "consume" the alias + perform side effects according to consumesEntityAlias()
// for collection-of-other, however, there is only one call
// it must "consume" the alias + perform side effects, despite what consumeEntityAlias() return says
//
// note: the logic for adding to the userAliasList is still strictly based on consumesEntityAlias return value
bool shouldCreateUserAlias = joinable.ConsumesEntityAlias();
if (!shouldCreateUserAlias && joinable.IsCollection)
{
// is it a collection-of-other (component or value) ?
var elementType = ((ICollectionPersister) joinable).ElementType;
if (elementType != null)
shouldCreateUserAlias = elementType.IsComponentType || !elementType.IsEntityType;
}
string sqlAlias = null;
if (shouldCreateUserAlias)
{
ICriteria subcriteria = translator.GetCriteria(path);
sqlAlias = subcriteria == null ? null : translator.GetSQLAlias(subcriteria);
if (joinable.ConsumesEntityAlias() && !translator.HasProjection)
{
includeInResultRowList.Add(subcriteria != null && subcriteria.Alias != null);
if (sqlAlias != null)
{
if (subcriteria.Alias != null)
{
userAliasList.Add(subcriteria.Alias); //alias may be null
resultTypeList.Add(translator.ResultType(subcriteria));
}
}
}
}
if (sqlAlias == null)
sqlAlias = base.GenerateTableAlias(n + translator.SQLAliasCount, path, joinable);
return sqlAlias;
}