Linq To SQL generates code that is not CLS compliant - by PSvahn

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 472971 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/7/2009 8:17:46 AM
Access Restriction Public


When adding inheritance relations between classes in the O/R designer, the acess level on the generated backing store member of the Id attribute, "_Id",  is changed from private to protected, causing the CLS rule violation. The Id property is used in an association between the classes.
Sign in to post a comment.
Posted by Microsoft on 7/14/2009 at 12:43 PM
Thanks for reporting the issue. Given the severity of the issue and where we are in the release, we won't be able to address this issue at this time.

We have spoken to Damien, who owns the LINQ to SQL Templates for T4 on CodePlex to consider stopping of prefixing fields with underscores, so that it is an option if you really do require CLS compliance of the generated code. You can find the T4 templates for LINQ to SQL at

LINQ to SQL team
Posted by Microsoft on 7/10/2009 at 3:12 AM
Thanks for your feedback. We are routing this bug to the product unit who works on that specific feature area. The team will review this issue and make a decision on whether they will fix it or not for the next release.

Thank you,
Visual Studio Product Team