Search code examples
entity-frameworkcode-first

How to ignore a property when using Entity Framework Code First


Entity Framework Code First will auto-create a table in the database base based on the Model.

Is there an attribute that will avoid this?


Solution

  • Add the [System.ComponentModel.DataAnnotations.Schema.NotMapped] attribute to the property.