I'm confused on how to get my objects from azure tables when the object contains a list of table entity objects. Here is an example of what I'm trying to store
public class Class1 : TableEntity
{
public string Property1 { get; set; }
public string Property2 { get; set; }
public List<Class2> Items { get; set; }
}
public class Class2 : TableEntity
{
public string Property1 { get; set; }
public string Property2 { get; set; }
}
Right now I'm trying to partition by user id and then each class 1 would have a row key of some id so I can get a list of class1
for the given user, or I can get single class1
objects by knowing the user and the id. I'm coming from a sql world and am brand new to table storage so I might be thinking about this whole thing incorrectly.
When I try and save Class1
to table storage everything saves except for the list. Whats the best way to store class 1 object? Is that even possible. I'm also thinking maybe I shouldn't be storing the list in the same table as the main object. I have scenarios where I'll need to edit individual items in the list, but if I store them all in the one table I'll have to pull out the entire object and find the item from the list I want to edit and put the whole object back.
I've been going through the getting started with azure table storage guide but nothing there seemed to make sense for the scenario I'm looking at here.