Entity Framework Core Ignore Method

The Ignore method of the EF Core Fluent API is used to Ignore a Property or Entity (Table) from being mapped to the database

Consider the following Model. 

Table of Contents

Ignore Property

The Age field in the Employee Class is redundant as we can always calculate it from the DOB property. Hence it is not required to be mapped to the database,

Ignore Entity

Similarly, we have TempTable, which we do not want to include in the database. You can use the Ignore method as shown below

The following image shows the model and the database generated.

Data Annotation

The Ignore method is equivalent to NotMapped Attribute data annotation. There is no equivalent convention available

2 thoughts on “Entity Framework Core Ignore Method”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top