Last post Mar 04, 2013 07:49 AM by nevets2001uk2
Mar 04, 2013 07:49 AM|nevets2001uk2|LINK
I'm trying to design a domain model of POCO classes for an ASP.NET MVC application. I'll be using EF to map the model to a new database.
I have a Person abstract class which is a base used by my Employee and Contact classes. This works fine and I can map to a single Person table in my database while having specific properties and logic for each distinct use of person.
I also have a customer class and need to handle a situation for the business. Their customers can be individual people or businesses. So I have created a Company class as well. My individuals will be represented by the Contact class.
I'm struggling now to determine how I should manage the requirement for a customer to be both a Contact or a Company. Does anyone have suggestions on a best design for this situation.
At the moment I'm consdiering having an IndiviualCustomer and a BusinessCutomer class deriving from the base customer and then relating to either the ContactID or CompanyID which may work in the database but feels a bit messy.