views:

130

answers:

1

I am using L2S and an inheritance model for mapping Persons against certain roles.

Guy Burstein's excellent blog post explains how to accomplish this:

http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/10/01/linq-to-sql-inheritance.aspx

However, I have a specific case where a Person has multiple roles. For example 'Jane Doe' is a Contact and a Programmer. In this model, she would need two rows in the People table, one as Contact (PersonType = 1) and one as Programmer (PersonType = 3).

If she changes her last name, and that update happens in her role as Contact, I would need to change all instances of 'Jane Doe' to reflect the name change everywhere.

What sort of best approach (improved data structure) could be used to change last name within all roles? Finally, I am hoping to avoid overriding each general form update events to include all instances, but that may be the only way. Any suggestions or approaches appreciated.

+1  A: 

From what I can tell from the information you provided your database should have three tables:

  1. People
  2. Programmers
  3. Contacts

Programmers and Contacts should have a foreign-key Person_fK.

In the object model Programmer and Contact would each have a Person property.

ondesertverge