Forum Xamarin Cross Platform with Xamarin

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
        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
        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; }

        public int StoreID { get; set; }
        public Store Store { get; set; }

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

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

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



  • kentuckerkentucker USMember ✭✭✭✭✭

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

  • 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.