I have a data modeling question that hopefully this fictious example will help explain. My application is data driven and the classes reflect the tables to a large degree. In this example my database has two tables:
- VendorMaster with an int Primary Key of VendorID
- VendorContact with an int Primary Key of ContactID
The VendorContact table also has a Foreign Key of VendorID in order to associate the contact with a specific Vendor. In this example a Vendor can only have one contact.
My question is how to represent these two tables in terms of classes. In my current design I have two classes:
In order to represent the relationship between a VendorMaster and VendorContact, my VendorMaster class contains a property called VendorContact.
My questions are about the VendorContact class and how it represents the relationship between a VendorMaster and itself.
The VendorContact class should contain an int property of VendorID
The VendorContact class should contain a VendorMaster Property
I am not sure which option is the 'best' option to take. My concern is that if I go with option #2 that I would create a cyclical relationship between the VendorMaster and Vendo
View Complete Post