samedi 21 novembre 2015

Can I specify a primary key with "unique" colums constraint in SQLite Net

I'm trying to specify a column constraint between the primary key and another column but I get an exception on insert.

As an example, I have multiple groups and the same folder might be present in every group but not multiple times in a group. The following table setup throws a constraint at insert when I share the same folder in another group.

public class GroupFolders
{
   [PrimaryKey, Indexed(Name = "someuniquetuple", Order = 1, Unique = true), Column("groupid")]
   public string GroupId { get; set; }

   [Indexed(Name = "someuniquetuple", Order = 2, Unique = true), Column("folderid")]
   public long FolderId { get; set; }
}

Aucun commentaire:

Enregistrer un commentaire