Full compliance with Code Analysis still possible when using LINQ?

R

rcook349

I would like to be in full-compliance with Code Analysis.

However, since I am using LINQ to SQL, I am frequently re-generating my
DataClasses.dbml as the data model continues to evolve. I.e. if I modified
the DBML to satisfy the Code Analysis items, I would just be wiping them out
again the next time (every time) I generate an updated DBML.

I'm sure I could turn off the Code Analysis checkboxes that pertain to those
errors, but I would really like to be able to say I am in full-compliance.

Any thoughts/suggestions?

Here are two sample errors:

Error 6 CA2227 : Microsoft.Usage : Change 'Tournament.TournamentPlayers' to
be read-only by removing the property setter.
C:\Data\Westinis\Projects\Tournama.Business.Library\DataClasses.designer.cs
1336 Tournama.Business.Library

Error 7 CA1056 : Microsoft.Design : Change the type of property
'Tournament.TournamentUrl' from string to System.Uri.
C:\Data\Westinis\Projects\Tournama.Business.Library\DataClasses.designer.cs
1259 Tournama.Business.Library

Thanks.
 
J

Jeroen Mostert

rcook349 said:
I would like to be in full-compliance with Code Analysis.
What, all of it, even the globalization parts? Och. :)
However, since I am using LINQ to SQL, I am frequently re-generating my
DataClasses.dbml as the data model continues to evolve. I.e. if I
modified the DBML to satisfy the Code Analysis items, I would just be
wiping them out again the next time (every time) I generate an updated
DBML.
Generated code should be exempted from code analysis. Unfortunately, the
DBML generator doesn't emit any attributes to indicate the code is generated.
I'm sure I could turn off the Code Analysis checkboxes that pertain to
those errors, but I would really like to be able to say I am in
full-compliance.
Turn off checking for those specific classes, not globally. I don't know if
this can be done with the Code Analysis interface integrated in VS, but it's
certainly possible by manually writing down the attributes if necessary.
Take a look at http://msdn.microsoft.com/library/ms244717
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top