Any thoughts on how can I implement object tree that is more than 2 level deep.
You can blob complex items any level deep but OrmLite’s POCO references only populates its disconnected POCOs 1-level deep using the Load*
APIs.
You can potentially use the Merge extension method to stitch different POCOs together based on their reference convention.
Thanks for this. Any solution during save, for example if I want to save
var secondChild = new SecondChild()
{
Id = Guid.NewGuid().ToString(),
Name = "SecondChild",
FirstChildR = new FirstChild()
{
Id = Guid.NewGuid().ToString(),
Name = "FirstChild",
ParentR = new Parent
{
Id = Guid.NewGuid().ToString(),
Name = "ParentOne"
}
}
};
db.Save(secondChild, references: true);
In the above example the 3rd level object (Parent) will not get saved.
Thanks
Jay
References are saved only 1-level deep, if it’s ok for the ParentR
to be blobbed, it will be saved automatically in the FirstChild
table by just removing the [Reference]
attribute otherwise if you want it saved in a separate table you’ll need to insert the ParentR
individually.