New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not possible to map Guid to columns declared as BLOB with SQLite #1068
Comments
Column type names mean nothing in SQLite. (See Determination Of Column Affinity for the only semantics applied to them.) In order to round-trip CLR types, we need to provide a mapping between CLR types and column type names. Our current default mapping is compatible with the mapping used in System.Data.SQLite's EF6 provider. As a TODO item, we need to allow users to override our default mapping with their own. The heart of the issue is that, if we see "BLOB" as the column type, how do we know whether to map that to a byte[] or Guid when the user calls DataReader.GetValue(). |
Just one more problem caused by the ever-useless dynamic typing "feature". |
"Column type names mean nothing in SQLite" Fixing the code
And then doing conversion from byte[] <=> Guid via a NotMapped property also makes the scenario "work" |
The changes described in #736, #738, and #771 will probably be needed here (at least to avoid other similar issues), along with making sure that the query pipeline is using the generic ReadValue. This will flow the CLR type being requested down to the ADO.NET provider layer such that a Guid object can be created when there is a Guid in the model. |
@ajcvickers @bricelam Sounds promising, thanks! |
This appears to be fixed now. |
The test class (to be located in the SQLIte Functional Tests project) sums up the issue..
It is perfectly legal to declare a column as blob, and store Guids in this column as byte(16)
In fact there is no datatype called UNIQUEIDENTIFIER in sqlite.
Have no idea if this is an issue with EF or the SQLite ADO.Net provider also part of this project, ie the sqlite type map or what.
The text was updated successfully, but these errors were encountered: