B
BobRoyAce
Let's say that you have two entities: Franchises and Franchise Owners.
Since a Franchise can have multiple Franchise Owners associated with
it, and a Franchise Owner could be associated with more than one
Franchise, I created three tables: Franchises, FranchiseOwners, and
FranchiseFranchiseOwners. One of the fields in the
FranchiseFranchiseOwners table tells the PercentageOwnership between
the FranchiseOwner and the Franchise.
OK, so I created two classes: Franchise and FranchiseOwner. The
Franchise class has a property, called FranchiseOwners, which is a
List(Of FranchiseOwner). What I am wondering about now, however, is
how to go about implementing a many-to-many relationship with my
classes. Should I, for example, add FranchiseID and
PercentageOwnership properties to my FranchiseOwner class and then
populate the latter based on the value of the former? Should I create
a third, FranchiseFranchiseOwner class?
Since a Franchise can have multiple Franchise Owners associated with
it, and a Franchise Owner could be associated with more than one
Franchise, I created three tables: Franchises, FranchiseOwners, and
FranchiseFranchiseOwners. One of the fields in the
FranchiseFranchiseOwners table tells the PercentageOwnership between
the FranchiseOwner and the Franchise.
OK, so I created two classes: Franchise and FranchiseOwner. The
Franchise class has a property, called FranchiseOwners, which is a
List(Of FranchiseOwner). What I am wondering about now, however, is
how to go about implementing a many-to-many relationship with my
classes. Should I, for example, add FranchiseID and
PercentageOwnership properties to my FranchiseOwner class and then
populate the latter based on the value of the former? Should I create
a third, FranchiseFranchiseOwner class?