-
Notifications
You must be signed in to change notification settings - Fork 97
Support reading Guid values from TEXT columns #191
Comments
Thanks Rowan! Is this something that I should jump on with a pull request or will you be able to knock it out fairly quickly? |
Pull request would be great - we are swamped at the moment. |
First pull request created. :) Although I think I might have picked the wrong stream to pull from, can we change it on the fly before I start working? |
Think you must start over. First fork, clone, branch |
My thoughts on this: If the bytes returned by |
Anyone had time to look at this? |
I have it working. I took your suggestion Brice and converted it to text to make sure the length was correct. Not sure if I did this correctly but I checked in my changes here. https://github.com/aspnet/Microsoft.Data.Sqlite/compare/dev...RonFrick:ron?expand=1 |
Here? public override Guid GetGuid(int ordinal) => new Guid(GetGuidBlob(ordinal)); This throws an exception… public override Guid GetGuid(int ordinal) => new Guid(GetBlob(ordinal)); |
Is it just the naming that is a problem? We could still call it GetBlob and use an overload? public override Guid GetGuid(int ordinal) => new Guid(GetBlob(ordinal,true)); private string GetBlob(int ordinal,bool isGuid)
|
This also works but it is not safe? public override Guid GetGuid(int ordinal) => new Guid(GetBlob(ordinal).ToString().Substring(0,36)); |
I am using EntityFrameworkCore1.0.0 and this seems it's still not working. Any update on it? |
This is on our backlog to enable in a future release. Currently, our SQLite provider requires that GUIDs be stored in binary. The workaround would be to map the column to a string property (which can be private) and then have an unmapped property that does the conversion to/from a GUID. |
Until this is supported out of the box, I have a working version of Microsoft.Data.Sqlite that will allow you to use Guids as strings with EF. Let me know if you want it and I can post it somewhere for you. |
@RonFrick I would love to give it a try, please let me know where I can download it? Thanks! |
Copied from dotnet/efcore#3950
Currently we assume GUID values are stored in BLOB columns, so you get an exception when we try to parse the value when it is stored as a STRING.
The text was updated successfully, but these errors were encountered: