In a MVC 3 solution, under VS 2012, it sounds strange that you receive such message after Running Code Analysis:

It is strange because the class which is mentioned in the "DON'T" analysis was generated by VS itself (not me).
To reproduce this you can:
So, the question is, what could we do: Refactor the auto-generated code or ignore this message?
Below a sample of auto generated class which violates the rule CA2214:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Backoffice.Entities
{
using System;
using System.Collections.Generic;
public partial class BR_SIMUL_Supermarket_Product
{
public BR_SIMUL_Supermarket_Product()
{
this.BR_SIMUL_Supermarket_Product_Price = new HashSet<BR_SIMUL_Supermarket_Product_Price>();
}
public int product_id { get; set; }
public int category_id { get; set; }
public string product_name { get; set; }
public string product_measure { get; set; }
public bool product_active { get; set; }
public virtual BR_SIMUL_Supermarket_Category BR_SIMUL_Supermarket_Category { get; set; }
more stuff here...
Here's how I solved it permanently: http://chuckbeasley.com/blog/?p=42200
This is by design to allow for lazy loading. When you access the classs through DbContext it won't fail at run-time despite the warning. You should suppress the warnings only in those files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With