c# - Multidimenstional Arrays And Observable Collection -
i've seen many observablecollection<t>
examples of 2-dimensional object, i'm working multi-dimensional object.
the faith life church daily bible reading api produce json data, below (this shortened, brevity)...
{ "dailychapter": [{ "date": "2016-02-01", "book": "esther", "chapter": 7, "verses": [{ "number": 1, "text": "so king , haman came banquet esther queen." }, { "number": 2, "text": "and king said again unto esther on second day @ banquet of wine, thy petition, queen esther? , shall granted thee: , thy request? , shall performed, half of kingdom." }] }, { "date": "2016-02-02", "book": "esther", "chapter": 8, "verses": [{ "number": 1, "text": "on day did king ahasuerus give house of haman jews' enemy unto esther queen. , mordecai came before king; esther had told unto her." }, { "number": 2, "text": "and king took off ring, had taken haman, , gave unto mordecai. , esther set mordecai on house of haman." }] }, { "date": "2016-02-03", "book": "esther", "chapter": 9, "verses": [{ "number": 1, "text": "now in twelfth month, is, month adar, on thirteenth day of same, when king's commandment , decree drew near put in execution, in day enemies of jews hoped have power on them, (though turned contrary, jews had rule on them hated them;)" }, { "number": 2, "text": "the jews gathered in cities throughout provinces of king ahasuerus, lay hand on such sought hurt: , no man withstand them; fear of them fell upon people." }] }] }
i have class, json, structure (classes generated json2csharp)...
public class verses { public int number { get; set; } public string text { get; set; } } public class dailychapter { public string date { get; set; } public string book { get; set; } public int chapter { get; set; } public list<verses> verses { get; set; } } public class rootobject { public list<dailychapter> dailychapter { get; set; } }
i have level of background in databases, initial idea use observablecollection
flat database, so...
date book chapter versenumber versetext "2016-02-01" "esther" 7 1 "so king..." "2016-02-01" "esther" 7 2 "and king..." "2016-02-02" "esther" 8 1 "on day..." "2016-02-02" "esther" 8 2 "and king..." "2016-02-03" "esther" 9 1 "now in the..." "2016-02-03" "esther" 9 2 "the jews gathered..."
my observablecollection's class structured such...
public class biblereadingcollection { public string date { get; set; } public string book { get; set; } public int chapter { get; set; } public int versenumber { get; set; } public string versetext { get; set; } public biblereadingcollection(string _date, string _book, int _chapter, int _versenumber, string _versetext) { date = _date; book = _book; chapter = _chapter; versenumber = _versenumber; versetext = _versetext; } } // create collection (like array) binding data added public static observablecollection<biblereadingcollection> biblereadingcollection = new observablecollection<biblereadingcollection>();
my intention use observablecollection feed ui of app in master/detail type of scenario (master being date/chapter , detail being series of verses). theoretically, master list populated form of linq statement , clicking on 1 of chapters fire linq statement populate detail list verses.
my question whether right way think observablecollections (like flat database). maybe better have each day (and, thusly, each chapter) single record (row) , somehow nest verses within record. i'm not sure if that's possible (can stick observablecollection or array within observablecollection?). know, in sql-land, can join tables don't duplicate data. then, can create query output looks flat database.
what guys think? i'm amateur developer, lot of these concepts new me.
Comments
Post a Comment