src/Shared/EntityFramework/Core/Objects/ELinq/OrderByLifter.cs
// <summary>
// Returns a lifter instance which supports lifting the intrinsic order of the given
// source expression across specific operations (filter, project, oftype, skip, and limit)
// </summary>
// <remarks>
// Lifting only occurs for expressions that are ordered. Each of the nested
// OrderByLifterBase class implementations represents one or two of the ordered patterns with
// the exception of the PassthroughOrderByLifter. The latter class represents expressions
// without intrinsic order that therefore require no lifting.
// </remarks>
Returns a lifter instance which supports lifting the intrinsic order of the given
source expression across specific operations (filter, project, oftype, skip, and limit)
Returns a lifter instance which supports lifting the intrinsic order of the given source expression across specific operations ( filter project oftype skip and limit )
internal static OrderByLifterBase GetLifter(DbExpression source, AliasGenerator aliasGenerator)
                {
                    if (source.ExpressionKind
                        == DbExpressionKind.Sort)
                    {
                        return new SortLifter((DbSortExpression)source, aliasGenerator);
                    }
                    if (source.ExpressionKind
                        == DbExpressionKind.Project)
                    {
                        var project = (DbProjectExpression)source;
                        var projectInput = project.Input.Expression;
                        if (projectInput.ExpressionKind
                            == DbExpressionKind.Sort)
                        {
                            return new ProjectSortLifter(project, (DbSortExpression)projectInput, aliasGenerator);
                        }
                        if (projectInput.ExpressionKind
                            == DbExpressionKind.Skip)
                        {
                            return new ProjectSkipLifter(project, (DbSkipExpression)projectInput, aliasGenerator);
                        }
                        if (projectInput.ExpressionKind
                            == DbExpressionKind.Limit)
                        {
                            var limit = (DbLimitExpression)projectInput;
                            var limitInput = limit.Argument;
                            if (limitInput.ExpressionKind
                                == DbExpressionKind.Sort)
                            {
                                return new ProjectLimitSortLifter(project, limit, (DbSortExpression)limitInput, aliasGenerator);
                            }
                            if (limitInput.ExpressionKind
                                == DbExpressionKind.Skip)
                            {
                                return new ProjectLimitSkipLifter(project, limit, (DbSkipExpression)limitInput, aliasGenerator);
                            }
                        }
                    }
                    if (source.ExpressionKind
                        == DbExpressionKind.Skip)
                    {
                        return new SkipLifter((DbSkipExpression)source, aliasGenerator);
                    }
                    if (source.ExpressionKind
                        == DbExpressionKind.Limit)
                    {
                        var limit = (DbLimitExpression)source;
                        var limitInput = limit.Argument;
                        if (limitInput.ExpressionKind
                            == DbExpressionKind.Sort)
                        {
                            return new LimitSortLifter(limit, (DbSortExpression)limitInput, aliasGenerator);
                        }
                        if (limitInput.ExpressionKind
                            == DbExpressionKind.Skip)
                        {
                            return new LimitSkipLifter(limit, (DbSkipExpression)limitInput, aliasGenerator);
                        }
                        if (limitInput.ExpressionKind
                            == DbExpressionKind.Project)
                        {
                            var project = (DbProjectExpression)limitInput;
                            var projectInput = project.Input.Expression;
                            if (projectInput.ExpressionKind
                                == DbExpressionKind.Sort)
                            {
                                return new ProjectLimitSortLifter(project, limit, (DbSortExpression)projectInput, aliasGenerator);
                            }
                            if (projectInput.ExpressionKind
                                == DbExpressionKind.Skip)
                            {
                                return new ProjectLimitSkipLifter(project, limit, (DbSkipExpression)projectInput, aliasGenerator);
                            }
                        }
                    }
                    return new PassthroughOrderByLifter(source, aliasGenerator);
                }
internal static OrderByLifterBase GetLifter ( DbExpression source , AliasGenerator aliasGenerator ) { if ( source . ExpressionKind == DbExpressionKind . Sort ) { return new SortLifter ( ( DbSortExpression ) source , aliasGenerator ) ; } if ( source . ExpressionKind == DbExpressionKind . Project ) { var project = ( DbProjectExpression ) source ; var projectInput = project . Input . Expression ; if ( projectInput . ExpressionKind == DbExpressionKind . Sort ) { return new ProjectSortLifter ( project , ( DbSortExpression ) projectInput , aliasGenerator ) ; } if ( projectInput . ExpressionKind == DbExpressionKind . Skip ) { return new ProjectSkipLifter ( project , ( DbSkipExpression ) projectInput , aliasGenerator ) ; } if ( projectInput . ExpressionKind == DbExpressionKind . Limit ) { var limit = ( DbLimitExpression ) projectInput ; var limitInput = limit . Argument ; if ( limitInput . ExpressionKind == DbExpressionKind . Sort ) { return new ProjectLimitSortLifter ( project , limit , ( DbSortExpression ) limitInput , aliasGenerator ) ; } if ( limitInput . ExpressionKind == DbExpressionKind . Skip ) { return new ProjectLimitSkipLifter ( project , limit , ( DbSkipExpression ) limitInput , aliasGenerator ) ; } } } if ( source . ExpressionKind == DbExpressionKind . Skip ) { return new SkipLifter ( ( DbSkipExpression ) source , aliasGenerator ) ; } if ( source . ExpressionKind == DbExpressionKind . Limit ) { var limit = ( DbLimitExpression ) source ; var limitInput = limit . Argument ; if ( limitInput . ExpressionKind == DbExpressionKind . Sort ) { return new LimitSortLifter ( limit , ( DbSortExpression ) limitInput , aliasGenerator ) ; } if ( limitInput . ExpressionKind == DbExpressionKind . Skip ) { return new LimitSkipLifter ( limit , ( DbSkipExpression ) limitInput , aliasGenerator ) ; } if ( limitInput . ExpressionKind == DbExpressionKind . Project ) { var project = ( DbProjectExpression ) limitInput ; var projectInput = project . Input . Expression ; if ( projectInput . ExpressionKind == DbExpressionKind . Sort ) { return new ProjectLimitSortLifter ( project , limit , ( DbSortExpression ) projectInput , aliasGenerator ) ; } if ( projectInput . ExpressionKind == DbExpressionKind . Skip ) { return new ProjectLimitSkipLifter ( project , limit , ( DbSkipExpression ) projectInput , aliasGenerator ) ; } } } return new PassthroughOrderByLifter ( source , aliasGenerator ) ; }
Returns a lifter instance which supports lifting the intrinsic order of the given
source expression across specific operations (filter, project, oftype, skip, and limit)
Returns a lifter instance which supports lifting the intrinsic order of the given source expression across specific operations ( filter project oftype skip and limit )
// source.Sort(o).Project(p).Limit(k).* is equivalent to transformation for  // source.Sort(o).Limit(k).Project(p).*  // source.Skip(k, o).Project(p).Limit(k2).* is equivalent to transformation for  // source.Skip(k, o).Limit(k2).Project(p).*
source
DbExpression
aliasGenerator
AliasGenerator
remarks
Lifting only occurs for expressions that are ordered. Each of the nested
OrderByLifterBase class implementations represents one or two of the ordered patterns with
the exception of the PassthroughOrderByLifter. The latter class represents expressions
without intrinsic order that therefore require no lifting.
Lifting only occurs for expressions that are ordered . Each of the nested OrderByLifterBase class implementations represents one or two of the ordered patterns with the exception of the PassthroughOrderByLifter . The latter class represents expressions without intrinsic order that therefore require no lifting .