Unique Constraints in the Entity Framework
The Microsoft EF team is currently designing unique constraint support in EF. See http://blogs.msdn.com/b/efdesign/archive/2011/03/09/unique-constraints-in-the-entity-framework.aspx. Vote for this to make sure this is also supported by DevArt's provider.
-
jongleur commented
Hi.
Are there any plans to Support unique constraints in line with the Index Attribute introduced by EF 6.1 (see http://blogs.msdn.com/b/adonet/archive/2014/02/11/ef-6-1-0-beta-1-available.aspx and http://blog.oneunicorn.com/2014/02/15/ef-6-1-creating-indexes-with-indexattribute/ ?
It's defined in System.ComponentModel.DataAnnotations.Schema.IndexAttribute and supports the Definition of unique constraints as well as General indices spanning one or more attributes.
It would be nice to get something like that in the SQL code generation of dotConnect (for Oracle in my case).
I did not try it out yet, but I guess it should be possible to use it already by defining the attributes in the EntityDeveloper and use the client-side checks hopefully included in EF on SaveChanges. -
Remco Blok commented
It looks like unique constraints can also be added through EF Code First Migrations. See http://blogs.msdn.com/b/adonet/archive/2011/11/29/code-first-migrations-beta-1-no-magic-walkthrough.aspx. There is another suggestion on uservoice for adding Code First Migrations support to DevArt here http://devart.uservoice.com/forums/105163-ado-net-entity-framework-support/suggestions/1883603-code-first-database-evolution-database-schema-
-
AdminDevart (_, Devart) commented
We will support this feature when unique constraints are supported in Entity Framework mapping and run-time. Currently our support is the following: if a table does not have a primary key but has a unique key, entity key is set to unique key constraint columns when creating a model in Entity Developer with the Database First approach.