Using Guid as PK
See original GitHub issueI am running into an issue using Guid as a primary key in SQLite. Is this not supported? Can you modify the connection string like so? BinaryGUID=False;
Here is the error and stack. {“Byte array for GUID must be exactly 16 bytes long.”}
at System.Linq.Expressions.Interpreter.ByRefMethodInfoCallInstruction.Run(InterpretedFrame frame)
at System.Linq.Expressions.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Linq.Expressions.Interpreter.LightLambda.Run(Object[] arguments)
at Thunk(Func2 , DbDataReader ) at Microsoft.Data.Entity.Storage.Internal.TypedRelationalValueBufferFactory.Create(DbDataReader dataReader) at Microsoft.Data.Entity.Query.Internal.QueryingEnumerable.Enumerator.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__12.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at Microsoft.Data.Entity.Query.LinqOperatorProvider.ExceptionInterceptor
1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
BinaryGuid=False
is not an available option in your connection string in EF7.Sqlite. This connection string parameter is a feature of System.Data.Sqlite. EF.SQlite uses instead Microsoft.Data.Sqlite under the hood.I have my own version of Microsoft.Data.Sqlite to fix the problem, and I can now query the data just fine, but now when I save a guid it saves as binary and not text. This is causing problems when trying to query the data once it is saved.