I have an existing model, SomeModel
, which contains a property Prop
. I'd like to enforce that the values of Prop
be unique.
To this end, I'm adding the following to my model:
public static void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<SomeModel>()
.HasAlternateKey(a => a.Prop);
}
but ef migrations
isn't picking up the change.
How can I correct this?