lundi 9 février 2015

Allow NULL Foreign Keys with SQLite-net-extensions

I'd like to know if I can, with a SQLite database and SQLite-Net Exensions, add 2 foreign keys to the same table with, each time, one of the foreign keys empty.


My structure is the following:



[Table("Picture")]
public class Picture
{
[PrimaryKey]
public int Id { get; set; }

public string Name { get; set; }

[ForeignKey(typeof(Contact))] // => Allow Null ?
public string TokenContact { get; set; }

[ForeignKey(typeof(Profile))] // Allow Null ?
public string TokenProfile { get; set; }
}

[Table("Contact")]
public class Contact
{
[PrimaryKey]
public string Token {get;set;}

[OneToMany]
public ObservableCollection<Picture> CollectionPicture {get; set;}
}

[Table("Profile")]
public class Profile:Contact
{

// Some other properties...

}


Thanks for your advices !


Aucun commentaire:

Enregistrer un commentaire