In example 1, the .HasKey operation is a no operation because the entity contains no entity by the name of "asdf", whereas in the second example a property named "key" does exist, but since it is ignored, we throw an exception.
exception:
The key component 'key' is not a declared property on type 'Entity'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property.
example 1:
modelBuilder.Entities<Object>()
.Configure(c => c
.Ignore("key"));
modelBuilder.Entities<Entity>()
.Configure(c => c
.HasKey("asdf"));
example 2:
modelBuilder.Entities<Object>()
.Configure(c => c
.Ignore("key"));
modelBuilder.Entities<Entity>()
.Configure(c => c
.HasKey("key"));
exception:
The key component 'key' is not a declared property on type 'Entity'. Verify that it has not been explicitly excluded from the model and that it is a valid primitive property.
example 1:
modelBuilder.Entities<Object>()
.Configure(c => c
.Ignore("key"));
modelBuilder.Entities<Entity>()
.Configure(c => c
.HasKey("asdf"));
example 2:
modelBuilder.Entities<Object>()
.Configure(c => c
.Ignore("key"));
modelBuilder.Entities<Entity>()
.Configure(c => c
.HasKey("key"));