EF Code-First Migration - Ignore Property
entity-framework, entity-framework-migrations
Solution
You can use NotMappedAttribute
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.notmappedattribute(v=vs.103).aspx
Or I prefer to use fluent mapping as it doesn't clutter my domain model with data access concerns.
modelBuilder.Entity<MyPoco>().Ignore(p => p.MyPocoTypeEnum);
Problem
I have a simple poco class that has an enum property (Needed so that I can still have the code first create the enum lookup table). I don't want the migration generator to add this column to the database. Is there an attribute or some other way to let the migration code know to ignore the property? Example: ``` public class MyPoco { public int MyPocoId { get; set; } public int MyPocoTypeId { get; set; } public MyPocoTypeEnum MyPocoTypeEnum { get { return (MyPocoTypeEnum)MyPocoTypeId; } set { MyPocoTypeId = (int)value; } } } ```