c# - Model Design As Database Table Or Multi-Dimensional List? -


i'm working group of data (the bible), recurring fields (book, chapter, etc...), , trying decide on how structure it.

here example of 2 designs i'm looking at. 1 more useful/appropriate/beneficial other?

table design:

class bible {     public string version { get; set; }     public string book { get; set; }     public int chapter { get; set; }     public int verse { get; set; }     public string text { get; set; } } 

obviously, there lot of wasted memory in table design (because of repeated data). version same every entry, book repeated entries, chapter repeated less entries. verse , text unique, each record. on other hand, that's how databases have worked forever (unless you're going relational route). it's super-easy grab data.

list design:

class verse {     public int number { get; set; }     public string text { get; set; } } class chapter {     public int number { get; set; }     public list<verse> verses { get; set; } } class book {     public string name { get; set; }     public list<chapter> chapters { get; set; } } class bible {     public string version { get; set; }     public list<book> books { get; set; } } 

this more concise, memory stand-point, have foreach need find. i'm not sure if linq works well, multi-dimensionality (maybe it's great, i've used on flat data).

what guys think? there times when each choice or 1 going default choice?

the second 1 better choice default operations. table construct that, flat table. it's missing database features, fast lookup indices.

in second version, find book , have chapters in it. in table version, whatever do, have transverse whole data structure.

the table version has redundant data and slower use. seems win-win real data model.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -