New Posts New Posts RSS Feed: Bug/Issue with orderby GUIDs in cache
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Bug/Issue with orderby GUIDs in cache

 Post Reply Post Reply
Author
jsobell View Drop Down
Groupie
Groupie
Avatar

Joined: 02-Apr-2009
Location: Australia
Posts: 80
Post Options Post Options   Quote jsobell Quote  Post ReplyReply Direct Link To This Post Topic: Bug/Issue with orderby GUIDs in cache
    Posted: 20-Jul-2010 at 11:24pm
Slightly unusual bug here...

SQL Server does not order GUIDs in the same way as .NET, so if you query against the cache you will get very different search order results to the server's returned order.

According to Microsoft's doco the SQL Server uses only the last eight digits of the GUID for sorting. This is a total pain in the bum, but such is life.
We use the following extension to Guid to ensure our internal sorts match SQL Server's:

public static int CompareToSql(this Guid left, Guid value)
{
  return (left.ToString().Substring(24).CompareTo(value.ToString().Substring(24)));
}

The cache in DF appears to do a regular sort, so in some cases (such as ours, surprise surprise) it breaks if the QueryStrategy is not set to QueryStrategy.DataSourceOnly

Just another interesting issue found while converting an EF4 app to IdeaBlade :)

I'll include this in an incident report.
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jul-2010 at 7:09pm

Yep, we ran into this as well.  We'll take care of it along with the String equality issues. ;)

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down