locked
Class Design query RRS feed

  • Question

  • Hi All,

          How to design classes for complex many to many relationships in tables in the DB?

    e.g consider an Employee table and a Role table and also a Association table to link between these 2 tables say - Employee_Role table which also have columns like startdate,enddate,isActive,isDeleted etc - in such cases, in general an Employee and a Role Class can be there which will have properties corresponding to Employee and Role table columns.Also Employee will have a list of Roles.But whats the best class design to put the properties corresponding to startdate,enddate,isActive and isDeleted columns of Employee_Role table.

    Regards,

    Sandip

    Wednesday, August 4, 2010 4:47 PM

Answers

  • It's an interesting question.  I think from something like Entity Framework perspective it only uses the cross-reference tables for relationships which translates to navigational properties like you described.  I think the only way to actually get to those columns on the Employee_Role table is introduce an EmployeeRole class.
    Wednesday, August 4, 2010 8:28 PM

All replies

  • It's an interesting question.  I think from something like Entity Framework perspective it only uses the cross-reference tables for relationships which translates to navigational properties like you described.  I think the only way to actually get to those columns on the Employee_Role table is introduce an EmployeeRole class.
    Wednesday, August 4, 2010 8:28 PM
  • You can introduce EmployeeRole class if the intersection table has important columns which needs to be queried/reported like the ones you mentioned.

    Regards

    Suds

    Thursday, August 5, 2010 10:36 AM