If you want to ignore a class property in Entity Framework , you can mark the property with the NotMapped data annotations.
How to Ignore a Class Property in Entity Framework ?
Below is a sample code snippet show how you can apply the NotMapped data annotations.
public class Employee
{
public string Name { set; get; }
public DateTime DateOfBirth{ set; get; }
[NotMapped]
public int Age { set; get; }
}
Leave a Reply