Dictionary to Array before Write to DB

Oct 9, 2013 at 10:18 PM
I'm attempting to convert from what the application uses (Dictionary<string, object>) to an array before it's inserted into the DB.

Here's what I'm calling on the parent object (InspectionHistory)
       public void PrepareForDB()
            foreach (Subgroup subgroup in this.Subgroups.Values)

            this.SubgroupsDB = this.Subgroups.Values.ToArray();
I have a similar function all the way down the object structure. However, I only get data in the InspectionHistory table. :(

At one point I was able to get data into the subgroup table (2nd Level), but this was when I was doing this "conversion" during the addition of new objects into the dictionary. I don't feel this is the proper way to do it, and I couldn't get any deeper than that level.

Here's a quick explanation of the object structure...

InspectionHistory (Top Level)
Subgroup (InspectionHistory can have 1 or more Subgroup(s))
BaseFeature (Subgroup can have 1 or more BaseFeature(s))
ISample (BaseFeature can have 1 or more ISample(s))
Trait (ISample can have 1 or more Trait(s))


I really need help getting this information into the DB. Then I have to verify I can retrieve it back out as well.

Thanks in advance!
Oct 10, 2013 at 12:29 AM
I'm not sure I fully understand. Can you mock up something with, say, just the History, Subgroup and Base Feature?