I am learning c# at the moment, I used to program using Unix/C - Oracle and lately I am learning to do windows programming.
Since in c# (or at least using MVC) the data or database table is represented as object/class.
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
Table: Computers
Fields: ComputerId, Maker, PONumber, SerialNumber, DismantleFlag
Table: Parts
Fields: PartId, ComputerId, PONumber, PartDescription, SerialNumber
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.
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)
class Part
{
properties PartId, PONumber, PartDescription, SerialNumber
}
class Computer
{
properties ComputerId, Maker, PONumber, SerialNumber, DismantleFlag
List<Part>Parts
}
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.
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?
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?
Thank you.