title: c# data object model representation
body: <p>I am learning c# at the moment, I used to program using Unix/C - Oracle and lately I am learning to do windows programming.</p>
  
  <p>Since in c# (or at least using MVC) the data or database table is represented as object/class.</p>
  
  <p>For example say, a simple computer shop part tracking; a shop can purchase a computer and dismantle it into parts and they can sell the parts; or the parts can also be purchase from supplier individually.
  in relational database we can have something like</p>
  
  <pre><code>Table: Computers
  Fields: ComputerId, Maker, PONumber, SerialNumber, DismantleFlag
  
  Table: Parts
  Fields: PartId, ComputerId, PONumber, PartDescription, SerialNumber
  </code></pre>
  
  <p>say if the shop want to trace a part where they but it from, we do query on parts table using part serial number if computerId is null then get the detail where the part is bought from using PONumber, if computerId is not null then use PONumber from computers table.</p>
  
  <p>so if we do the same using model representation I think it would go something like this. (I know the syntax is not correct, it's just a representation)</p>
  
  <pre><code>class Part
  {
     properties PartId, PONumber, PartDescription, SerialNumber
  }
  
  class Computer
  {
     properties ComputerId, Maker, PONumber, SerialNumber, DismantleFlag
  
     List&lt;Part&gt;Parts
  }
  </code></pre>
  
  <p>so I would assume there will be object for a list of Parts to store all the parts that purchase individually and there is also object for a list computers which in turn has a list of parts inside them if DismantleFlag is Y.</p>
  
  <p>is that mean if I want to do the same operation to trace the parts, I have to go trough the list of parts object, and I also need to go through list of computers object and for each computer object I need to scan through all the parts with in the computer object?</p>
  
  <p>if my understanding is correct then relational database is more simpler to store and manage data, and how it is going to be translated in MVC if the data/model is not represented in object form?</p>
  
  <p>Thank you.</p>