public SalesPriceForCurrentUOMWithTemplateItem(PXCache cache, int?inventoryID, string uom, decimal qty) : base(cache, inventoryID, uom, qty)
            {
                SelectCommand.Join <InnerJoin <InventoryItem,
                                               On <InventoryItem.inventoryID, Equal <ARSalesPrice.inventoryID> > > >();

                SelectCommand.OrderByNew <OrderBy <Desc <ARSalesPrice.isPromotionalPrice,
                                                         Desc <ARSalesPrice.siteID,
                                                               Desc <ARSalesPrice.breakQty,
                                                                     Asc <InventoryItem.isTemplate> > > > > >();
            }
        /// <summary>
        /// 连接语句并返回当前语句
        /// </summary>
        /// <typeparam name="T">实体类类型</typeparam>
        /// <typeparam name="TAnother">另个表格的实体类类型</typeparam>
        /// <param name="cmd">查询语句</param>
        /// <param name="joinType">连接模式</param>
        /// <param name="currentExpr">当前实体类主键属性</param>
        /// <param name="anotherAction">设置选择语句的方法</param>
        /// <param name="anotherExpr">另个实体类主键属性</param>
        /// <exception cref="ExpressionInvalidException">表达式不正确</exception>
        /// <exception cref="NullAttributeException">没有设置特性</exception>
        /// <returns>当前语句</returns>
        public static SelectCommand Join <T, TAnother>(this SelectCommand cmd, SqlJoinType joinType, Expression <Func <T, Object> > currentExpr, Action <SelectCommand> anotherAction, Expression <Func <TAnother, Object> > anotherExpr)
        {
            MemberExpression currentLeft = ExpressionHelper.GetMemberExpression(currentExpr.Body);
            MemberExpression anotherLeft = ExpressionHelper.GetMemberExpression(anotherExpr.Body);

            if (currentLeft == null || anotherLeft == null)
            {
                throw new ExpressionInvalidException();
            }

            DatabaseColumnAttribute currentAttr = ExpressionHelper.GetColumnAttribute(cmd, currentLeft);
            DatabaseColumnAttribute anotherAttr = ExpressionHelper.GetColumnAttribute(cmd, anotherLeft);

            if (currentAttr == null || anotherAttr == null)
            {
                throw new NullAttributeException();
            }

            String anotherTableName = EntityHelper.InternalGetTableName(typeof(TAnother));

            return(cmd.Join(joinType, currentAttr.ColumnName, anotherTableName, anotherAttr.ColumnName, anotherAction));
        }
 /// <summary>
 /// 全连接语句并返回当前语句
 /// </summary>
 /// <typeparam name="T">实体类类型</typeparam>
 /// <typeparam name="TAnother">另个表格的实体类类型</typeparam>
 /// <param name="cmd">查询语句</param>
 /// <param name="currentExpr">当前实体类主键属性</param>
 /// <param name="anotherAction">设置选择语句的方法</param>
 /// <param name="anotherExpr">另个实体类主键属性</param>
 /// <exception cref="ExpressionInvalidException">表达式不正确</exception>
 /// <exception cref="NullAttributeException">没有设置特性</exception>
 /// <returns>当前语句</returns>
 public static SelectCommand FullJoin <T, TAnother>(this SelectCommand cmd, Expression <Func <T, Object> > currentExpr, Action <SelectCommand> anotherAction, Expression <Func <TAnother, Object> > anotherExpr)
 {
     return(cmd.Join <T, TAnother>(SqlJoinType.FullJoin, currentExpr, anotherAction, anotherExpr));
 }
 /// <summary>
 /// 右连接语句并返回当前语句
 /// </summary>
 /// <typeparam name="T">实体类类型</typeparam>
 /// <typeparam name="TAnother">另个表格的实体类类型</typeparam>
 /// <param name="cmd">查询语句</param>
 /// <param name="currentExpr">当前实体类主键属性</param>
 /// <param name="anotherExpr">另个实体类主键属性</param>
 /// <exception cref="ExpressionInvalidException">表达式不正确</exception>
 /// <exception cref="NullAttributeException">没有设置特性</exception>
 /// <returns>当前语句</returns>
 public static SelectCommand RightJoin <T, TAnother>(this SelectCommand cmd, Expression <Func <T, Object> > currentExpr, Expression <Func <TAnother, Object> > anotherExpr)
 {
     return(cmd.Join <T, TAnother>(SqlJoinType.RightJoin, currentExpr, anotherExpr));
 }