lundi 29 juin 2015

creating sqlite db using datamodel c# windows Store App

I'm trying to create a sqlite db locally on a windows store app; using c#. I keep getting the error "don't know about sqliteDataGroup..." When using the following datamodel to create the tables...: (sqlite-net + extensions)... Any Ideas?

public class sqliteDataItem
{
    public sqliteDataItem()
    {

    }

    public sqliteDataItem(int Id, String title, String subtitle, String Image, String description, String itemcontent, int groupid)
    {
        this.Id = Id;
        this.Title = title;
        this.Subtitle = subtitle;
        this.Description = description;
        this.Image = Image;
        this.ItemContent = itemcontent;
        this.GroupId = groupid;
    }

    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }

    [ForeignKey(typeof(sqliteDataGroup))]
    public int GroupId { get; set; }
    public string Title { get; set; }
    public string Subtitle { get; set; }
    public string Description { get; set; }
    public string Image { get; set; }
    public string ItemContent { get; set; }
    [ManyToOne]
    public sqliteDataGroup sqliteDataGroup { get; set; }
    public override string ToString()
    {
        return this.Title;
    }
}


/// <summary>
/// Generic group data model.
/// </summary>
public class sqliteDataGroup
{
    public sqliteDataGroup()
    {

    }

    public sqliteDataGroup(int Id, String title, String subtitle, String Image, String description)
    {
        this.Id = Id;
        this.Title = title;
        this.Subtitle = subtitle;
        this.Description = description;
        this.Image = Image;
        this.Items = new List<sqliteDataItem>();
    }

    [PrimaryKey,AutoIncrement]
    public int Id { get; set; }
    public string Title { get; set; }
    public string Subtitle { get; set; }
    public string Description { get; set; }
    public string Image { get; set; }
    [OneToMany]
    public List<sqliteDataItem> Items { get; set; }

    public override string ToString()
    {
        return this.Title;
    }
}

Aucun commentaire:

Enregistrer un commentaire