How to Ignore a Class Property in Entity Framework ?


This content was proof-read by Grammarly. You can Try Grammary for FREE

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; }
}

%d bloggers like this: