I'm having difficulty trying to implement an SQLite-Extensions example for Windows Phone 8.1 that features a OneToMany relation. I'd really like to use this feature but I'm pulling my hair out trying to get it to work. Like in this question, when I try to use the provided example for a Stocks table that has a List of Valuations:
public class Stock
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[MaxLength(8)]
public string Symbol { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)] // One to many relationship with Valuation
public List<Valuation> Valuations { get; set; }
}
public class Valuation
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[ForeignKey(typeof(Stock))] // Specify the foreign key
public int StockId { get; set; }
public DateTime Time { get; set; }
public decimal Price { get; set; }
[ManyToOne] // Many to one relationship with Stock
public Stock Stock { get; set; }
}
and I try to create the table I get the error:
An exception of type 'System.NotSupportedException' occurred in app_name.exe but was not handled in user code Additional information: Don't know about >System.Collections.Generic.List`1 [app_name.Model.modelName]
I had initially included a NuGet package reference to sqlite-net as well as SQLiteNetExtensions-PCL but it was previously mentioned that this is due to the wrong version of sqlite-net being referenced.
However I've tried downloading the source for sqlite-net and building this locally and it doesn't get referenced directly by SQLiteNetExtensions.
I've included the source locally in my solution as well it doesn't seem to make a difference. Would anybody have any further suggestions? I haven't come across any downloadable example for this.
If you have added a reference to SQLiteNetExtensions-PCL, you do NOT also need to manually add a reference to SQLite from VS/Add References as the Nuget package includes the correct version for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With