Skip to content

Saving Items as byte array was a bad idea #8

Description

@DiFFoZ

Many users report that saving a INSERT query with an external program (e.g. HeidiSQL) can cause a broken Items byte array:

[04:00:52 ERR][Microsoft.EntityFrameworkCore.Query] An exception occurred while iterating over the results of a query for context type 'Kits.Databases.Mysql.KitsDbContext'.
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
  at System.IO.BinaryReader.ReadByte () [0x00018] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.IO.BinaryReader.Read7BitEncodedInt () [0x00019] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at System.IO.BinaryReader.ReadString () [0x0000f] in <695d1cc93cca45069c528c15c9fdd749>:0 
  at Kits.API.KitItem.Deserialize (System.IO.BinaryReader br) [0x00000] in <b408e3839c8d44bc9b2d7caa48eb86b2>:0 
  at Kits.Extensions.ConvertorExtension.ConvertToKitItems (System.Byte[] block) [0x00034] in <b408e3839c8d44bc9b2d7caa48eb86b2>:0 
  at (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.EntityFrameworkCore.Query.QueryContext,System.Data.Common.DbDataReader,Microsoft.EntityFrameworkCore.Query.Internal.ResultContext,int[],Microsoft.EntityFrameworkCore.Query.Internal.ResultCoordinator)
  at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1+AsyncEnumerator+<MoveNextAsync>d__17[T].MoveNext () [0x001ce] in <04749dad1c80429287c0de883da70092>:0

So, I'm thinking to rewrite it to use one of two options:

  • Saving Items as Json column (best for users experience)
  • Saving Items to another table with FK of Id

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions