Creating Unique Key in Entity Framework Model First approach

88 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 answers

0
jonas On

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

With fluent API

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