Is there a way to mark an auto-generated class as ExcludeFromCodeCoverage. I am using that attribute in other areas and works great. But if you open the code of the auto-generated guy and mark the classes as ExcludeFromCodeCoverage, once you re-generate that class itll be over written.
I can create partial classes in the code behind of the dbml and apply that attribute to it and it works, however, that would make for a lot of partial classes.
You can use PostSharp or other AOP framework to create aspect which will apply
ExcludeFromCodeCoverageAttributeto specified types or namespaces:Then just apply this aspect to assembly and provide namespace which you want to exclude. During compilation PostSharp will add
ExcludeFromCodeCoverageAttributeto all classes inMy.AutogeneratedCodenamespace:Sample code and explanations you can find here.