I'm using EF6 code first with .NET4(I should deliver the project on win xp so I couldn't configure it with .NET4.5) in a win Form project.
I have a BaseEntity class that all other entities inherited from it:
public abstract class BaseEntity
{
public int Id {get; set;}
public int X {get; set;}
public int Y {get; set;}
}
public class Calendar:BaseEntity
{
// properties
}
How could I Ignore X,Y properties in my all entities without writing following code for each entity?
modelBuilder.Entity<Calendar>()
.Ignore(t => t.X)
.Ignore(t => t.Y)
Note that I couldn't use [NotMapped]
attribute because I'm using EF6 with .NET 4.