Re: LinqToSql Paging problem (bug?) with Skip and Take

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • d-42

    Re: LinqToSql Paging problem (bug?) with Skip and Take

    You wrote a great deal and there is so much I would have liked to
    elaborate on but this really de-railed the whole debate. You posted
    that linq DOES throw an exception if its not ordered, and that runs
    contrary to my experience.

    On Apr 21, 1:26 am, "Frans Bouma [C# MVP]"
    <perseus.usenet NOS...@xs4all.n lwrote:
    >
    Back to the linq provider: using skip/take without orderby gives an
    exception. This is to prevent that your application keeps on working
    and produces WRONG results.
    We wouldn't be having this conversation if it had thrown an error. It
    doesn't. For as much as I'd like linq to provide its own default
    consistent paging-semantics friendly row ordering when one isn't
    specified, i don't mind having to provide my own. But I did NOT expect
    linq to just start spitting random rows at me.

    After finally determining the right place to look in the linq to sql
    docuentation: it turns out in linq to sql, skip/take on an unordered
    query is 'undefined', not 'throw an exception'.

    Personally I still think it should throw an error rather than
    returning something that's undefined, and that it would be useful for
    linq to impose a default ordering that would be consistent between
    page requests on its own (although I understand that would impose a
    performance hit on certain types of query -- so maybe it should be an
    option instead of automatic (e.g. page(int skiprows, int takerows,
    bool AutoOrdering) but that's a question for the next version i guess.
    At least the issue is documented if you look in the right place.

    -best regards,
    Dave
Working...