So according to your description i would presume that person has it's
own identity value as do corporate as do contact, they all are
entities in your domain model.

So i suggest using a standard mapping per class model, so separate
mapping for contact, and party (could be discrimator type)

On Jan 13, 4:30 pm, "[email protected]"
<[email protected]> wrote:
> Hi,
>
> Could someone please let me know a good approach to map this legacy
> database schema?  I've tried using joined-subclass but the keying is a
> bit mad (the relationships are one-to-many rather than one-to-one and
> they keys are at the wrong end).  There is a big VB6/COM nightmare
> hanging off the database so we can't change the table structure (very
> very unfortunately).
>
> Table model:
>
>   [contact] -> contact_id, notes, person_id, corporate_id
>   [person] -> person_id, first_name, last_name
>   [corporate] -> corporate_id, name
>
>   1:n between contact->person on person_id
>   1:n between contact->corporate on corporate_id
>
> Class model:
>
> abstract class Party {
>     long Id { get; set; }
>     string Notes { get; set; }
>
> }
>
> class Person : Party {
>     string FirstName { get; set; }
>     string LastName { get; set; }
>
> }
>
> class Corporate : Party {
>    string Name { get; set; }
>
> }
>
> As said, I've tried the following things:
>
> 1. joined-subclass.  No luck.  Unfortunately the keys are not 1:1
> although there is technically a 1:1 relation, the person and corporate
> tables are keyed the wrong way round in the contact table.
> 2. view.  I'll have to write all the update sql if i do that which i'd
> rather like to avoid.  Someone else had a go but it was somewhat
> complicated to get working.
> 3. union-subclass.  Doesn't apply AFAIK.
>
> Any other ideas?  Apart from beating whoever designed the table
> structure which is my personally preferred approach but doesn't solve
> anything?
>
> Cheers,
>
> Chris Smith
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to