Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppressing LINQ to SQL DBML warnings

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?

like image 994
Max Strini Avatar asked Oct 27 '10 22:10

Max Strini


1 Answers

I am not sure how to suppress the warning but since I have control of the stored procedure that was causing the problem on my system I cast the return value to a smaller decimal which removed the warning.

SELECT CAST(SUM(AdFee) AS DECIMAL(19, 3))
like image 132
john Avatar answered Oct 22 '22 08:10

john