Open Closed

Decimal Types being truncated using auto-generated InsertAsync #6445


User avatar
0
kstieby created
  • ABP Framework version: 7.4.2
  • UI Type: Blazor Server
  • Database System: EF Core (SQL server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I have an entity, workstation, created in abp.suite that has a latitude and longitude of type decimal. I have modified the generated crud page to allow for more decimal places (6) so that I can input a latitude and longitude for my entity. When checking the database for the workstation records, I notice that the latitude and longitude have been truncated at only 2 decimal places. I traced through the application layers in debug mode and found that the 6 decimal places were remaining and were being sent into _workStationRepository.InsertAsync(workStation);

In this picture, the top 4 entries were created using sql scripts and the bottom entry was created using my abp.io application where the latitude and longitude entered were 0.123456 and 0.123456 respectively.


2 Answer(s)
  • User Avatar
    0
    kstieby created

    Update: Before b.Property(x => x.Longitude).HasColumnName(nameof(VehicleScan.Longitude)) After b.Property(x => x.Longitude).HasColumnName(nameof(VehicleScan.Longitude)).HasColumnType("decimal(12,8)"); This modification to Dbcontext fixed the issue.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. Your question credit has been refunded.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 25, 2025, 11:10