Options for Unique field in Entity Framework - navigation property to dbSet?
问题 After much research it seems Entity Framework 4.4 doesn't support Unique constraints. Yes it can & should be done at the database, but I'd much prefer it happen in model validation so the warning to user is prettier. It would be ideal for programmers to be able to decorate the property with a [Unique] attribute and it should be possible somehow, eg.: public class UserGroup { public int UserGroupID { get; set; } [Required] [Unique] public string Name { get; set; } [Required] public string