Creating Unique Key in Entity Framework Model First approach

138 Views Asked by At

is there anyway to create unique key in model first approach? I tried but does not found any property in property box.

1

There are 1 best solutions below

0
On

With data-annotations [Key] attribute over the property.

With fluent API

modelBuilder.Entity<yourModel>().HasKey(t => t.yourProp);