These are chat archives for PomeloFoundation/Home

14th
Feb 2017
pegasy
@pegasy
Feb 14 2017 22:53

Hi, does this (Pomelo.EntityFrameworkCore.MySql) support ulong (mapped to bigint in mysql)?

I created an entity with ulong as PK and I can add it and save it just fine but when I try to get it (using .Find or .FirstOrDefault) I get an exception saying "Unable to cast object of type 'System.Int64' to type 'System.UInt64'.".

This is the stacktrace I get.
   at Microsoft.EntityFrameworkCore.Storage.SynchronizedMySqlDataReader.ConvertWithReflection[T](Int32 ordinal, InvalidCastException e)
   at Microsoft.EntityFrameworkCore.Storage.SynchronizedMySqlDataReader.GetFieldValue[T](Int32 ordinal)
   at lambda_method(Closure , DbDataReader )
   at Microsoft.EntityFrameworkCore.Storage.Internal.TypedRelationalValueBufferFactory.Create(DbDataReader dataReader)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
   at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.Internal.MySqlQueryingEnumerable`1.MySqlEnumerator.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at lambda_method(Closure , QueryContext )
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass20_0`1.<CompileQueryCore>b__0(QueryContext qc)
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
   at RaidBot.Database.GuildRepository.GetGuild(UInt64 id) in E:\code\git\RaidBot\RaidBot\Database\GuildRepository.cs:line 25