6

I've generated LINQ to SQL classes from a database not under my control which has a lot of Decimal(38, 5) fields. Apparently the range of the .NET Decimal type is smaller than this, so the LINQ to SQL code generator is throwing a lot of warnings:

DBML1008: Mapping between DbType 'Decimal(38,5)' and Type 'System.Decimal' in Column 'StructGable24InchOCStuds' of Type 'AddersAndMultiplier' may cause data loss when loading from the database

It's extremely unlikely that any of these fields will ever have a value big enough to cause data loss in practice so I'd like to suppress these warnings. However, apparently setting warning suppression through the dialog in VS doesn't work with LINQ to SQL code generator warnings - is there another method?

4

1 回答 1

3

我不确定如何抑制警告,但由于我控制了导致系统出现问题的存储过程,因此我将返回值转换为较小的小数,从而消除了警告。

SELECT CAST(SUM(AdFee) AS DECIMAL(19, 3))
于 2011-01-21T18:55:23.700 回答