question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I 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.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.<SelectManyIterator>d__12.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at Microsoft.Data.Entity.Query.LinqOperatorProvider.ExceptionInterceptor1.EnumeratorExceptionInterceptor.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
natemcmastercommented, Dec 2, 2015

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.

0reactions
RonFrickcommented, Jun 18, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are the best practices for using a GUID as a primary ...
Using GUID as primary key is a definitive scaling stopper, and a critical one. I recommend you check database identity and sequence option....
Read more >
Guid vs INT - Which is better as a primary key?
The GUID is just an alternate key, with a NonClustered index, and is passed in from the application, but only resides in the...
Read more >
Integer or GUID as the data type for your primary key?
Choosing INT or GUID as PK data type, all depends on what database engine you are using and the type of solution you...
Read more >
Using a Guid as a PK, best practices. : r/SQLServer
Creates a GUID that is greater than any GUID previously generated by this function on a specified computer since Windows was started. That...
Read more >
UUID or GUID as Primary Keys? Be Careful! | by Tom Harrison
There are several reasons using a UUID as a PK would be great compared to auto-incrementing integers: At scale, when you have multiple ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found