Wondering if Entity Framework 5 supports unique constraints on entity properties? If so, how can I specify that a property should be unique?
As mentioned above it is not supported but as for now when I create a database programmatically (Code First) I use the following code in the init db section:
MainDBContext mainDBContext = new MainDBContext();
mainDBContext.Database.ExecuteSqlCommand("ALTER TABLE table_name ADD CONSTRAINT uc_FieldName UNIQUE(FieldName)");
mainDBContext.Dispose();