Linq2db doesn't support read numeric into BigInteger
See original GitHub issueDescribe your issue
While reading entity with BigInteger property (dbtype - numeric(78,0)) - linq2db throws exception
Exception message: System.OverflowException: Numeric value does not fit in a System.Decimal
Stack trace: System.OverflowException: Numeric value does not fit in a System.Decimal
at Npgsql.Internal.TypeHandlers.NumericHandlers.NumericHandler.Read(NpgsqlReadBuffer buf, Int32 len, Boolean async, FieldDescription fieldDescription)
at Npgsql.NpgsqlDataReader.GetFieldValue[T](Int32 ordinal)
at Npgsql.NpgsqlDataReader.GetDecimal(Int32 ordinal)
at lambda_method56(Closure, IQueryRunner, DbDataReader)
at LinqToDB.Linq.QueryRunner.Mapper`1.Map(IDataContext context, IQueryRunner queryRunner, DbDataReader dataReader, ReaderMapperInfo& mapperInfo)
at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
at LinqToDB.Linq.Builder.FirstSingleBuilder.FirstSingleContext.<>c__DisplayClass4_0`1.<<GetFirstOrDefaultElement>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at LinqToDB.Linq.ExpressionQuery`1.LinqToDB.Async.IQueryProviderAsync.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
at Domain.Services.FundsTransferService.TransferAsync(String senderAddress, String recipientAddress, BigInteger amount) in
Steps to reproduce
var transfer = await connection.Transfers.FirstOrDefaultAsync();
builder.Entity<Transfer>()
.HasPrimaryKey(x => x.Id)
.Property(x => x.Amount).HasPrecision(78).HasScale(0);
Environment details
Linq To DB
version: 5.0.0
Database (with version): Postgres
Issue Analytics
- State:
- Created 7 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
LINQ throwing invalid cast exception on a bigint
The exception seems to be thrown from the Entity Framework. You might have the column set as int instead of bigint in the...
Read more >[sqlite] "BIGINT" doesn't act like INTEGER on table creation ...
It is merely an integer column, completely separate from the rowid, whcih you happen to want to be the primary key. Since the...
Read more >Supported Types and their Mappings
The following lists the built-in mappings when reading and writing CLR types ... numeric, decimal, byte, short, int, long, float, double, BigInteger (6.0+)....
Read more >Announcing Entity Framework 7 Preview 5 - .NET Blog
Entity Framework 7 (EF7) Preview 5 has shipped with support for Table-per-Concrete type (TPC) mapping. This blog post will focus on TPC.
Read more >W3layouts cms exploit
Which of the following raises the number 6 to the third power? ... Android Studio does not open missing essentian plugin android studio...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My bad, should be:
Solved, thanks!