none
Entity Framework 4: How to Suppress code analysis in EF? RRS feed

All replies

  • Hi JJChen,

    Welcome!
    We will do some more pending research  about your problem and come back as soon as possible, Thanks for understanding.
    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 7, 2011 8:38 AM
    Moderator
  • Hi JJChen

     

    The code generated from edmx designer uses a default template and doesn't use the GeneratedCodeAttribute. This was initially raised as a concern by few developers on http://connect.microsoft.com/VisualStudio/feedback/details/434118/entity-framework-generated-code-raises-warnings-in-code-analysis

     

    And the reason for not using the attribute is specified in the above link . Just to quote from the link

    "The generated code can not follow all the fxcop guidelines because of other requirements( mainly around Serialization). The guidance here is to put GeneratedCode attribute on the members of the generated code so that FXCop does not flag these errors. In .Net 4.0( which is our next release and Beta 1 of which is available now), we moved to use T4 templates for code generation. So it will be easier to modify the templates that we ship so that these attributes are produced in the generated code. The reason we did not add these attributes in the templates we ship is because we did not want to clutter the templates."

    Hope this helps !

     


    Bindesh V[MSFT] Community Forum Escalation This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, January 19, 2012 8:20 AM
  • Hi Bindesh,

    Thanks for providing the above link and explaining why.

    We are agree with the comments in the link. The "clutter" seems is not a good reason.

    Does Entity Framework team plans to fix this problem in the next release?

    thx! 


    JaneC
    Thursday, January 19, 2012 4:39 PM