Domanda

I'm using SQLMetal to generate my LINQ to SQL DBML file. It creates a ".designer" file as well that has all the generated code.

It has a bunch of classes and properties that are being flagged by FX Cop for casing issues.

I've followed this stack overflow post on how to check FX Cop to suppress case issues. That seems to be working however I cannot now figure out how to add the "Generate Code" attribute to each class inside the designer file.

Can I globally ignore that particular CS file?

È stato utile?

Soluzione

I solved this problem with a macro that does a find/replace on all DatabaseAttributes and TableAttributes. It replaces these with the GeneratedCode attribute, followed by a newline, followed by the original line. Each class in the .designer file starts with one of those attributes so the macro gets them all. It's not an ideal solution, but it's better than manually adding the GeneratedCode attribute to each class every time you modify the DBML.

Altri suggerimenti

My current project stopped using sqlmetal a while ago and switched to t4 templates. We have complete control over the code that gets generated and we are much happier with the results. We rolled our own but there are many good examples out there.

This one on codeplex seems a little stale but could be a good starting point.

An old post by Oleg Sych is worth checking out. He is the T4 guru.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top