For example I have the following tables:
Class Customer
{
public string UserId { get; set;}
public string CustomerId { get; set;}
}
How can I specify that the PK is UserId and not the CustomerId?
Even though I specify the entity key like this, EF still assumes that CustomerId is PK:
modelBuilder.Entity<Customer>(entity =>
{
entity.HasKey(e => e.UserId)
.HasName(...);
...
Apparently, there should be mentioned somehow to EF to ignore CustomerId.
How can I achieve that?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…