I am working on an asp.net application. I need help designing the database related model and linq queries.
I have three tables ( and two lookup tables).
1)Product header (product header id as Primary key) 2) Product Detail(it has product header id as foreign key) 3) product attachment (it has product detail id as foreign key)
Now, I need to insert record in db.
a) for one Product header record there can be multiple Product detail records b) for multiple product detail records, there can be multiple attachments.
I have created three entities for each tables. Product header also has two keys from user table and history table. but on view I need to show the user name instead of the key. Should I create a view model class which will hold all these entity classes as properties and how can I make sure that there first record is inserted in product header, then product details and then product attachment ?
Please suggest.
Thanks