Don't know about System.Collections.Generic.List - SQLiteConnection.CreateTable<>

Hi, I'm new on SQLite. I made a research and decided to try, but on my first project, I'm stuck and I found no solution for my issue.
The error that I receive:
System.NotSupportedException: Don't know about System.Collections.Generic.List`1 [...Inventory]
My models:

public class Store
    {
        [PrimaryKey]
        public int StoreID { get; set; }
        public string SID { get; set; }
        public string Name { get; set; }

        [OneToMany(CascadeOperations = CascadeOperation.All)]
        public List<Inventory> Inventories { get; set; }
    }

 public class Inventory
    {
        [PrimaryKey]
        public int InventoryID { get; set; }
        public DateTime CloseDate { get; set; }
        public string InventoryType { get; set; }
        public DateTime LastUpdated { get; set; }
        public bool IsSuppressed { get; set; }
        public bool DeletionConfirmed { get; set; }

        [ForeignKey(typeof(Store))]
        public int StoreID { get; set; }
        [ManyToOne]
        public Store Store { get; set; }

        public string CloseDate_Description => CloseDate.ToString("MMMM dd, yyyy");
    }

SQLiteConnection database;
database = DependencyService.Get<ISQLite>().GetConnection();
database.CreateTable<Store>();

Is there a solution for this? Thank you anyway. =)

Tagged:

Posts

  • kentuckerkentucker USMember ✭✭✭✭✭

    Do you have the SqlLite-Net extensions nuget package installed?

    https://www.nuget.org/packages/SQLiteNetExtensions/

  • MarceloAmadorMarceloAmador USMember ✭✭

    Worked. I removed every SQLite package from Nuget, cleaned the solution and then installed SQLite-Net Extensions from Nuget on the PCL project and Android and iOS projects.

    And also changed this on each platform SQLite file:

    new SQLiteConnection(new SQLitePlatformIOS(), DatabaseFilePath)

Sign In or Register to comment.