Skip to content

Support Ignore() for non entity type candidates #3867

Description

@divega

Currently Ignore<T>() with T being a candidate entity type will cause Code First to:

  1. Not try to include T in the model as an entity type.
  2. Ignore any property of type T declared on valid entity types.

Ignore currently doesn't work for T unless it is a candidate entity type. However it would be possibly more consistent and useful to extend it to ignore properties of other types, e.g.:

  1. Types that would not be handled by the type mapper but that would not be valid candidate entity types either, including:
    1. Any interface types.
    2. Any value types (e.g. unsigned integers with the SQL Server provider).
  2. Types that would otherwise be handled by the type mapper but that the user wishes to exclude.

Activity

  1. rowanmiller commented on Dec 1, 2015

    @rowanmiller
    Contributor

    We need to decide on what properties we include in the model before deciding on this

  2. added this to the milestone on Dec 8, 2015
  3. changed the title [-]Code First: Decide on behavior of Ignore() for non entity type candidates[/-] [+]Support Ignore() for non entity type candidates[/+] on Dec 10, 2015
  4. modified the milestones: 7.0.0, on Dec 10, 2015
  5. divega commented on Jan 20, 2016

    @divega
    ContributorAuthor

    We decided not to change what we currently do for Ignore<T>(), i.e. it is only supported to prevent types that would otherwise be pulled as candidate entity types from getting into the model.

    You can still use Ignore(property) (i.e. the version that takes a property expression or name) to ignore any specific properties in an entity type for all the other scenarios.

    Moving to backlog to track this as a possible post-RTM improvement.

  6. removed their assignment
    on Jan 20, 2016
  7. added this to the Backlog milestone on Jan 20, 2016
  8. 8 remaining items

  9. added 6 commits that reference this issue on May 27, 2021
    6f0602a
    f7f8f37
    41672a5
    1c3187e
    bd36bf6
    29fa0e3
  10. ghost closed this as completedin #25025on Jun 9, 2021
  11. ghost added a commit that references this issue on Jun 9, 2021
    4a67481
  12. modified the milestones: 6.0.0, on Jul 2, 2021
  13. modified the milestones: , 6.0.0 on Nov 8, 2021
  14. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions