How to include child property of LINQ to SQL object?
-
I'm pulling in a sql table via linq to sql called "Employee". There are a total of 11 fields within this Employee table, so my LINQ automatically creates properties such as the following: Employee.Name Employee.Address Employee.Phone etc... I now however, need to add a child property to each of these properties called "Location", but I'm not sure how I would do this. So for example, I would need to use code such as the following: Employee.Name.Location = 1; Employee.Address.Location = 2; Employee.Phone.Location = 3; etc... I know I could set this "Location" up directly within my linq to sql dbml file, however anytime I update my database, my dbml file would be overwritten, so I'd prefer to avoid that. Is there any other way I can setup this "Location" child property? Thanks.
-
I'm pulling in a sql table via linq to sql called "Employee". There are a total of 11 fields within this Employee table, so my LINQ automatically creates properties such as the following: Employee.Name Employee.Address Employee.Phone etc... I now however, need to add a child property to each of these properties called "Location", but I'm not sure how I would do this. So for example, I would need to use code such as the following: Employee.Name.Location = 1; Employee.Address.Location = 2; Employee.Phone.Location = 3; etc... I know I could set this "Location" up directly within my linq to sql dbml file, however anytime I update my database, my dbml file would be overwritten, so I'd prefer to avoid that. Is there any other way I can setup this "Location" child property? Thanks.
Okay I just went cross eyed trying to relate Linq to database design. I'm sorry but I need to go back to the fundamental of the underlying data structure. Create the following tables Person Locations/Addresses(these are probably the same thing as a Location will only have 1 address presumably. PhoneNumbers has a foreign key PersonID lnkPersonLocation - allows many to many links between location and person with a FK to both tables
Never underestimate the power of human stupidity RAH