本文整理汇总了C#中IPropertyMap.GetOrderByPropertyMap方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertyMap.GetOrderByPropertyMap方法的具体用法?C# IPropertyMap.GetOrderByPropertyMap怎么用?C# IPropertyMap.GetOrderByPropertyMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyMap
的用法示例。
在下文中一共展示了IPropertyMap.GetOrderByPropertyMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSelectManyManyPropertyStatement
protected virtual string GetSelectManyManyPropertyStatement(object obj, IPropertyMap propertyMap, IList idColumns, IList typeColumns, Hashtable hashPropertyColumnMap, IList parameters)
{
IColumnMap columnMap;
IClassMap classMap;
IPropertyMap refPropertyMap;
ITableMap tableMap;
ITableMap joinTableMap;
string colName;
IObjectManager om;
IColumnMap idColumnMap;
IPropertyMap myPropertyMap;
IColumnMap myColumnMap;
ITableMap myTableMap;
IColumnMap colColumnMap;
IColumnMap forColumnMap;
ITableMap forTableMap;
IColumnMap addColumnMap;
IColumnMap addIdColumnMap;
IColumnMap addMyColumnMap;
ITableMap addMyTableMap;
IColumnMap typeColumnMap;
IPropertyMap orderByMap;
string paramName = "";
classMap = propertyMap.MustGetReferencedClassMap();
tableMap = classMap.MustGetTableMap();
SqlSelectStatement select = new SqlSelectStatement(tableMap.SourceMap) ;
SqlTableAlias table = select.GetSqlTableAlias(tableMap);
joinTableMap = propertyMap.MustGetTableMap();
SqlTableAlias joinTable = select.GetSqlTableAlias(joinTableMap);
idColumnMap = propertyMap.GetIdColumnMap();
SqlColumnAlias idColumn = joinTable.GetSqlColumnAlias(idColumnMap);
myTableMap = idColumnMap.MustGetPrimaryKeyTableMap();
myColumnMap = idColumnMap.MustGetPrimaryKeyColumnMap();
if (myTableMap == null)
throw new MappingException("TableMap '" + idColumnMap.PrimaryKeyTable + "' Not Found!"); // do not localize
if (myColumnMap == null)
throw new MappingException("ColumnMap '" + idColumnMap.PrimaryKeyColumn + "' Not Found!"); // do not localize
SqlTableAlias myTable;
colColumnMap = propertyMap.GetColumnMap();
forTableMap = colColumnMap.MustGetPrimaryKeyTableMap();
forColumnMap = colColumnMap.MustGetPrimaryKeyColumnMap();
if (forTableMap == null)
throw new MappingException("TableMap '" + idColumnMap.PrimaryKeyTable + "' Not Found!"); // do not localize
if (forColumnMap == null)
throw new MappingException("ColumnMap '" + idColumnMap.PrimaryKeyColumn + "' Not Found!"); // do not localize
SqlTableAlias forTable = select.GetSqlTableAlias(forTableMap);
SqlColumnAlias forColumn = forTable.GetSqlColumnAlias(forColumnMap);
SqlColumnAlias colColumn = joinTable.GetSqlColumnAlias(colColumnMap);
orderByMap = propertyMap.GetOrderByPropertyMap();
foreach (IPropertyMap iRefPropertyMap in classMap.GetPrimaryPropertyMaps())
{
refPropertyMap = iRefPropertyMap;
if (!((refPropertyMap.IsCollection || (refPropertyMap.ReferenceType != ReferenceType.None && !(refPropertyMap.IsIdentity)))))
{
IColumnMap refColumnMap = refPropertyMap.GetColumnMap();
SqlColumnAlias refColumn = select.GetSqlColumnAlias(refColumnMap);
colName = refColumnMap.Name;
if (refPropertyMap.IsIdentity)
idColumns.Add(colName);
if (!(refPropertyMap.LazyLoad))
{
select.SqlSelectClause.AddSqlAliasSelectListItem(refColumn);
hashPropertyColumnMap[refPropertyMap.Name] = colName;
if (refPropertyMap == orderByMap)
select.SqlOrderByClause.AddSqlOrderByItem(refColumn);
}
}
}
typeColumnMap = classMap.GetTypeColumnMap();
if (typeColumnMap != null)
{
typeColumns.Add(typeColumnMap.Name);
SqlColumnAlias typeColumn = select.GetSqlColumnAlias(typeColumnMap);
select.SqlSelectClause.AddSqlAliasSelectListItem(typeColumn);
}
select.SqlFromClause.AddSqlAliasTableSource(table);
select.SqlFromClause.AddSqlAliasTableSource(joinTable);
//if (tableMap.SourceMap.Schema.ToLower(CultureInfo.InvariantCulture) == myTableMap.SourceMap.Schema.ToLower(CultureInfo.InvariantCulture) && tableMap.Name.ToLower(CultureInfo.InvariantCulture) == myTableMap.Name.ToLower(CultureInfo.InvariantCulture))
if (tableMap == myTableMap)
myTable = select.GetSqlTableAlias(myTableMap, "NPersistSelfRefTable");
else
myTable = select.GetSqlTableAlias(myTableMap);
SqlColumnAlias myColumn = myTable.GetSqlColumnAlias(myColumnMap);
select.SqlFromClause.AddSqlAliasTableSource(myTable);
SqlSearchCondition search = select.SqlWhereClause.GetNextSqlSearchCondition();
search.GetSqlComparePredicate(forColumn, SqlCompareOperatorType.Equals, colColumn);
//.........这里部分代码省略.........
示例2: GetSelectManyOnePropertyStatement
protected virtual string GetSelectManyOnePropertyStatement(object obj, IPropertyMap propertyMap, IList idColumns, IList typeColumns, Hashtable hashPropertyColumnMap, IList parameters)
{
string colName = "";
IColumnMap columnMap;
IClassMap classMap;
IPropertyMap refPropertyMap;
ITableMap tableMap;
ITableMap rootTableMap;
IColumnMap idColumnMap;
IPropertyMap myPropertyMap;
IColumnMap myColumnMap;
ITableMap myTableMap;
IColumnMap addIdColumnMap;
IColumnMap addMyColumnMap;
ITableMap addMyTableMap;
IColumnMap typeColumnMap;
IPropertyMap orderByMap;
string paramName = "";
classMap = propertyMap.MustGetReferencedClassMap();
IClassMap rootClassMap = classMap;
rootTableMap = classMap.MustGetTableMap();
tableMap = propertyMap.MustGetTableMap();
if (tableMap != rootTableMap)
{
bool done = false;
while (done == false && rootClassMap.InheritanceType != InheritanceType.ConcreteTableInheritance)
{
done = true;
IClassMap super = rootClassMap.GetInheritedClassMap();
if (super != null)
{
if (super.MustGetTableMap() == rootTableMap)
{
rootClassMap = super ;
done = false;
}
}
}
if (rootClassMap == null)
{
rootClassMap = classMap;
}
}
SqlSelectStatement select = new SqlSelectStatement(tableMap.SourceMap) ;
SqlTableAlias table = select.GetSqlTableAlias(tableMap);
idColumnMap = propertyMap.GetIdColumnMap();
SqlColumnAlias idColumn = table.GetSqlColumnAlias(idColumnMap);
myTableMap = idColumnMap.MustGetPrimaryKeyTableMap();
myColumnMap = idColumnMap.MustGetPrimaryKeyColumnMap();
if (myTableMap == null)
throw new MappingException("TableMap '" + idColumnMap.PrimaryKeyTable + "' Not Found!"); // do not localize
if (myColumnMap == null)
throw new MappingException("ColumnMap '" + idColumnMap.PrimaryKeyColumn + "' Not Found!"); // do not localize
SqlTableAlias rootTable = table;
if (tableMap != rootTableMap)
{
rootTable = select.GetSqlTableAlias(rootTableMap, "NPersistRootTable");
}
SqlTableAlias myTable;
SqlColumnAlias myColumn;
IObjectManager om;
orderByMap = propertyMap.GetOrderByPropertyMap();
//foreach (IPropertyMap iRefPropertyMap in rootClassMap.GetPrimaryPropertyMaps())
foreach (IPropertyMap iRefPropertyMap in rootClassMap.GetAllPropertyMaps())
{
refPropertyMap = iRefPropertyMap;
if (refPropertyMap.IsCollection)
{
if (this.Context.PersistenceManager.GetListCountLoadBehavior(LoadBehavior.Default, refPropertyMap) == LoadBehavior.Eager)
{
if (refPropertyMap.ReferenceType != ReferenceType.None)
{
ITableMap listTableMap = refPropertyMap.GetTableMap();
ISourceMap listSourceMap = listTableMap.SourceMap;
SqlSelectStatement subSelect = new SqlSelectStatement(listSourceMap);
SqlTableAlias listTable = subSelect.GetSqlTableAlias(listTableMap, "t" + select.GetNextTableAliasIndex());
SqlCountFunction count = new SqlCountFunction();
subSelect.SqlSelectClause.AddSqlAliasSelectListItem(count);
subSelect.SqlFromClause.AddSqlAliasTableSource(listTable);
foreach (IColumnMap fkIdColumnMap in refPropertyMap.GetAllIdColumnMaps())
{
IColumnMap pkIdColumnMap = fkIdColumnMap.MustGetPrimaryKeyColumnMap();
SqlColumnAlias fkIdColumn = listTable.GetSqlColumnAlias(fkIdColumnMap);
//.........这里部分代码省略.........