dotnet/efcore

Support Ignore() for non entity type candidates

divega opened this issue · 2 comments

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.

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

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.