Unique key applying on asp.net MVC 5 model property
问题 I have User(name,password) model and Roles model(id,role).Now what I want is mapping model(id,Uid,Rid) between these two models and here Uid,Rid foreign keys also Uid should be unique. How can acheive this. I have done with foreign key and with mapping table but I stuck at unique key applying on Uid. Can anyone help me in this? Thanks in advance. public class Image { public int id { get; set; } public string Name{ get; set; } public String Password { get; set; } } //User roles class public