OBJECTS
I'am using SQLite.NET-PCL and SQLiteNetExtensions
`public class Object1
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Object2> ListObject2 { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Object3> ListObject3 { get; set; }
}`
`public class Object2
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }
[ForeignKey(typeof(Object1))]
public int object1_id { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.All)]
public Object1 Object1 { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Object3> ListObject3 { get; set; }
}`
`public class Object3
{
[PrimaryKey, AutoIncrement]
public int id { get; set }
public string name {get; set;}
[ForeignKey(typeof(Object2))]
public int object2_id { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.All)]
public Object2 Object2 { get; set; }
[ForeignKey(typeof(Object1))]
public int object1_id { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.All)]
public Object1 Object1 { get; set; }
}`
this update works:
Object1.ListObject2 = Object2List;
connection.UpdateWithChildren(Object1);
then I do
Object2.ListObject3 = Object3List;
connection.UpdateWithChildren(Object2);
When i update object2 with children, Object2.object1_id is 0, I lose the foreign key with Object1.
Any idea? Whats is my problem? What 's the error?