I've been looking for a way to set a field unique , but i' am surprised i can't find anything like annotation on the field. In most of the resource online one have to write SQL
in an initializer. i was even hoping i could find something like
modelBuilder.Entity<Profile>().HasKey(p => p.RollNumber);
in which HasKey
could be HasUnique
or even HasUniqueKey
Is it that am not searching with the proper keyword or that annotation feature is simply not available (to my surprise ).