抑制 LINQ to SQL DBML 警告
我已经从不受我控制的数据库生成了 LINQ to SQL 类,该数据库有很多 Decimal(38, 5)
字段。显然 .NET Decimal 类型的范围比这个小,因此 LINQ to SQL 代码生成器会抛出很多警告:
DBML1008:从数据库加载时,“AddersAndMultiplier”类型的“StructGable24InchOCStuds”列中的 DbType“Decimal(38,5)”和类型“System.Decimal”之间的映射可能会导致数据丢失
这些字段中的任何一个都极不可能一个足够大的值,在实践中会导致数据丢失,所以我想抑制这些警告。但是,显然通过 VS 中的对话框设置警告抑制不适用于 LINQ to SQL 代码生成器警告 - 还有其他方法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定如何抑制警告,但由于我可以控制导致系统出现问题的存储过程,因此我将返回值转换为较小的小数,从而消除了警告。
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.