dimanche 26 juillet 2015

SQLite-Net Extension and FileModel

i want make a class representing file/folder, which has one or none parent and can contain files/folders. Because i thing folder is special case of file. My model looks like this:

namespace WPP3.Base.DataModel
{
  public class DbFileModel
  {
    [PrimaryKey]
    public string Path { get; set; }

    public DateTime DateCreated { get; set; }
    public DateTime DateModified { get; set; }
    public string DisplayName { get; set; }
    public bool isFile { get; set; }

    [ForeignKey(typeof(DbFileModel))]
    public string ParentID { get; set; }

    [OneToMany(null, null, CascadeOperations = CascadeOperation.All)]
    public List<DbFileModel> Files { get; set; }

    [ManyToOne(null, null, CascadeOperations = CascadeOperation.All)]
    public DbFileModel ParentFile { get; set; }
  }
}

But when i am trying to use this class, SQLite-NetExtension throws this exception: "DbFileModel.Files: OneToMany inverse relationship shouldn't be List or Array". Can you advise how make that class using SQLiteNetExtensions?

Thank you very much :-)

Aucun commentaire:

Enregistrer un commentaire