Defining a unique constraint on a column

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
jdooley
Posts: 2
Joined: Sat 27 Oct 2012 16:21

Defining a unique constraint on a column

Post by jdooley » Sat 27 Oct 2012 16:37

I'm currently evaluating the LinqConnect driver for SQLite and have hit a problem - how do I define a unique constraint on a column? I can't see any options for doing this...

If I define the constraint in the database and reverse engineer it back to the model, it does not seem to be picked up either....

Also while I'm at it how do I change the default mapping for C# to SQLite types - I want GUIDs mapped to TEXT columns? I can see how to change the mapping from DB to code, but not the reverse...

Thanks.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Defining a unique constraint on a column

Post by MariiaI » Tue 30 Oct 2012 09:08

At the moment there is no possibility to add a unique constraints on a column in the model. Unique constraints are taken into account and obtained only when creating an entity: if a table has no PK, then UK is taken to determine the Entity Key.
We currently have no plans for implementing this feature. There is a similar suggestion on our UserVoice, so you could also leave your vote there to increase the probability for adding this option:
http://devart.uservoice.com/forums/8026 ... ties-that-

As for the mapping settings, you could try doing the following:
- Open Database Explorer, right-click on Database Connection->Edit Connection Properies->Advanced;
- set there 'Binary GUID' parameter to false in the opened dialog window and save changes.
This property indicates whether to store GUID in the binary format or in the text format.
Keep in mind, that the Server Type of the property will remain GUID until you manually change it to a TEXT, but it will not affect the operation of the data and their storage.

Please tell us if this helps.

jdooley
Posts: 2
Joined: Sat 27 Oct 2012 16:21

Re: Defining a unique constraint on a column

Post by jdooley » Mon 05 Nov 2012 08:04

OK, thanks for the info, but without be able to define unique constraints, I feel that going from model to database is rather limited....

udayr
Posts: 6
Joined: Wed 11 Sep 2013 18:00

Re: Defining a unique constraint on a column

Post by udayr » Mon 09 Dec 2013 22:04

@mariial,

Does this apply for the dotConnect for SQLite? (Not being able to define Unique Keys on the model)

Is there any alternative or work around to implement Unique Keys that you know of?

Thanks in advance,
Uday

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Defining a unique constraint on a column

Post by MariiaI » Tue 10 Dec 2013 14:08

Does this apply for the dotConnect for SQLite? (Not being able to define Unique Keys on the model)
Yes, it is related to working with LinqConnect models, it doesn't depend on the data provider being used.
At the moment there is no possibility to add a unique constraints on a column in the model and there are no plans for implementing this feature. Unique constraints are taken into account and obtained only when creating an entity: if a table has no PK, then UK is taken to determine the Entity Key.

You could leave your vote here to increase the probability for adding this feature:
http://devart.uservoice.com/forums/8026 ... ties-that-

Post Reply