Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Reading Lists of GUID #161

Open
ssteiner opened this Issue · 1 comment

2 participants

@ssteiner

My data objects use GUIDs as PKs. Due to the way linq select is implemented, I want to selectively extract just my PKs, so I run a low level query
List allUsers = conn.Query("SELECT FrameworkUserUid FROM [FrameworkUser]").ToList();
Unfortunately, that gets me the right number of entries, but they are all Guid.Empty.

So I figured I'd try the other way, create a dummy class
internal class DummyGuid
{
public Guid Identifier { get; set; }
}

and run it as follows
List guids = conn.Query("SELECT 'FrameworkUserUid' AS 'Identifier' FROM FrameworkUser");
Unfortunately, same story here.

the issue seems to stem from the TableMapping class - it creates a TableMapping for the single Column with Name = Identifier... and as the SQL read gets a column name of FrameworkUserUid, no match can be found which explains why all my objects have Identifer = Guid.Empty.

On top of that, if I name members in my dummy class the same as in the DB, when reading Identifier, it reads it as text and the contents is "FrameworkUserUid".. not the actual value. So Guid parsing fails.

So, it seems remapping as per the API description is broken and on top of that, the tablemapper cannot deal with basic types.

@crishoj

@ssteiner , have you found a solution?

I suppose a low-level method a la ExecuteScalar<T> for fetching a column of values could be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.