I am trying to understand why Entity Framework 4 is rounding to two decimals when in both the EF schema model and in the database, the precision is set to 4.
This is my schema definition for one of the decimal field:
This is my database definition
CREATE TABLE OrderItems(
....
[SellPrice] [decimal](19, 4) NOT NULL,
....
When I execute my insert query after computing the sell price of the product, I see that there is enough decimal
The MiniProfiler show my query and it displays that the value has its decimal
DECLARE ...
@15 Decimal = '100,54347826086956521739130435',
...
insert [dbo].[OrderItems](..., [SellPrice], ...)
values (..., @15, ....)
select [OrderItemId]
from [dbo].[OrderItems]
where @@ROWCOUNT > 0 and [OrderItemId] = scope_identity()
But when I look through the Microsoft Sql Profiler, the SellPrice
is rounded
exec sp_executesql N'insert [dbo].[OrderItems](..., [SellPrice], ...)
values (..., @15, ...)',
...,@15=100.54,...'
I have trouble finding where the value is being rounded.