Page 1 of 1
Defining a unique constraint on a column
Posted: Sat 27 Oct 2012 16:37
by jdooley
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.
Re: Defining a unique constraint on a column
Posted: Tue 30 Oct 2012 09:08
by MariiaI
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.
Re: Defining a unique constraint on a column
Posted: Mon 05 Nov 2012 08:04
by jdooley
OK, thanks for the info, but without be able to define unique constraints, I feel that going from model to database is rather limited....
Re: Defining a unique constraint on a column
Posted: Mon 09 Dec 2013 22:04
by udayr
@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
Re: Defining a unique constraint on a column
Posted: Tue 10 Dec 2013 14:08
by MariiaI
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-