I'm using sqlite net extension to create one to many relationship for 2 tables that am using there are tables in my C# code i follow tutorial in official site https://bitbucket.org/twincoders/sqlite-net-extensions
[Table("Stock")]
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; }
}
[Table("Valuation")]
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; }
}
Here is my code to create Stockobject and insert it to Db
var valuation = new List<Valuation>();
valuation.Add(new Valuation { Price = 1 });
var stock = new Stock();
stock.Valuations = valuation;
db.InsertWithChildren(stock);
but when i debug code and read stock data from db it shows me null for list of valuation what is problem here ?
That'is how it shows to me