views:

263

answers:

1

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

+1  A: 

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)

[GeneratedCode]
public partial class Foo
{
}

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.

ShuggyCoUk
Adding the attribute for each class isn't feasible in this case, because the database is still in a state of flux. The moment the set of base classes changes, I'll get the same problems all over again.
Whatsit
I'd love to file a feature request for it, but I have no idea how. I can't find any official info on the tool other than what is in the MSDN library (http://msdn.microsoft.com/en-us/library/bb386987.aspx) which doesn't provide any sort of contact information.
Whatsit
since it is used via Visual Studio file a bug against it on the Microsoft connect website.
ShuggyCoUk
I would have thought that, given the hassle involved in adding/renaming a table the additional hassle of adding a new file to source control is not so bad...
ShuggyCoUk