忽略 SqlMetal 生成文件的代码分析
我正在开发一个 C# 项目,其中包含 SqlMetal 生成的文件。 我想使用代码分析。 我已在“代码分析”选项中打开“抑制生成代码的结果”,但它仍然报告 SqlMetal 类。 有什么办法可以关掉这个吗?
我正在使用 Visual Studio 2008 和 SqlMetal 2.0.50727.3082
I'm developing a C# project which includes a SqlMetal generated file. I'd like to use Code Analysis.
I've turned on "Suppress results from generated code" in the Code Analysis options, but it still reports on the SqlMetal classes. Is there some way to turn this off?
I'm using Visual Studio 2008 and SqlMetal 2.0.50727.3082
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种选择是编辑生成的源,以简单地将“部分”添加到您关心的类中。
添加一个单独的文件
然后你可以为你制作的每个类 Foo
然后重新生成时可能发生的最糟糕的情况是部分链接被破坏(这将导致编译错误,所以你知道这已经发生并且需要更正(简单而容易)。
我还建议您提交一个连接错误/请求,要求他们将此属性生成添加为 sql metal 本身的选项。
One option is to edit the generated source to simply add "partial" to the classes you care about.
Then you can add in a separate file(s)
for every class Foo you made partial
Then the worst that can happen on regeneration is that the partial link becomes broken (which will result in a compile error so you know that this has happened and needs correcting (simply and easily).
I would also suggest you file a connect bug/request asking for them to add this attribute generation as an option on sql metal itself.
这是一个已知问题(但遗憾的是,修正被推迟到 Visual Studio 2010 之后的下一个版本):
http://connect.microsoft.com/VisualStudio/feedback/details/470206/code-analysis-and-designer-files
This is a known issue (but sadly the correction is postponed to the next version after Visual Studio 2010) :
http://connect.microsoft.com/VisualStudio/feedback/details/470206/code-analysis-and-designer-files