I am creating a Logradouro
table where the CEP
field is not the primary key, but must be unique.
How do I do this using code-first in Entity 6.0 ?
To create primary key I use the HasKey
method:
ToTable("Logradouros").HasKey(x => x.LogradouroId);
I saw that in this method you can use more than one field by creating composite key. If CEP
needs to be unique and indexed should it be table key too?