To upload the collection you have to use the "where" attribute.
To store the collection the <any> should do the work (note: probably you
have to use the meta-value of <any> to store the appropriate
discriminator).

On Mon, Oct 4, 2010 at 7:03 PM, David McClelland <[email protected]
> wrote:

> Legacy DB mapping question:
>
> In our application we have multiple tables (Users, Contacts,
> Businesses) for items that may have one or more Addresses - these are
> referred to as AddressOwners.  There is a single association table
> that relates an AddressOwner to an Address in a many-to-many
> relationship:
>
> CREATE TABLE dbo.AddressOwners
> (
>        AddressOwnerId int IDENTITY PRIMARY KEY NOT NULL,
>        AddressId int NOT NULL,
>        OwnerId int NOT NULL,
>        AddressOwnerTypeId int NOT NULL,
>        IsPrimary bit NOT NULL,
>        CONSTRAINT FK_AddressOwners_AddressOwnerTypes FOREIGN KEY
> (AddressOwnerTypeId) REFERENCES dbo.AddressOwnerTypes
> (AddressOwnerTypeId),
>        CONSTRAINT FK_AddressOwners_Addresses FOREIGN KEY (AddressId )
> REFERENCES dbo.Addresses (AddressId )
> )
>
> Notice that we've got the expected foreign keys mapping to the
> AddressOwnerType table and the Addresses table - but there is no
> foreign key on the OwnerId column, because it could be an ID for a
> User, a Contact, or a Business (the type of ID is determined by the
> value in the AddressOwnerTypeId column).
>
> Since we maintain the concept of a "Primary Address" in the
> AddressOwners table, I have created an AddressOwner entity.  I see how
> using the <any> element can allow me to map a property on the
> AddressOwner entity to the actual Owner (a User, Contact, or Business
> entity).
>
> However, I'd like each of User/Contact/Business entities to have a
> collection of AddressOwner entities so we can (for example) load a
> User and all its address-related information.  This sounds like a
> collection property with some sort of a discriminator column...  but
> how would I map this in the User/Contact/Business entities?
>
> Thanks!
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
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