Are you fine with replacing List<List<>> with Dictionary<, List<>>? I think
you may need some facility to identity each list of lists anyway, at least
to be able to modify and/or delete them.

Regards,

--
Mohamed Meligy
Senior Developer, Team Lead Backup (.Net Technologies - TDG - Applications)
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE.

Phone:  +971 2 6992700
Direct:   +971 2 4045385
Mobile:  +971 50 2623624, +971 55 2017 621

E-mail: [email protected]
Weblog: http://weblogs.asp.net/meligy


On Mon, Jan 4, 2010 at 6:18 PM, Jørn Schou-Rode <[email protected]> wrote:

> I have a `Rotation` class, which must contain references to multiple
> lists of `Advert` objects. I would prefer an implementation where
> `Rotation` has a property of type `List<List<Advert>>` to hold these,
> but I am unable to come up with an NHibernate mapping supporting this.
>
> In the database schema, the many-to-many relation between `Rotation`
> and `Advert` is represented as a table `RotationAdvert` with the
> following columns:
>
>  * RotationID
>  * AdvertID
>  * Variant ("horizontal position" / index within outer list)
>  * Position ("vertical position" / index within inner list)
>
> The best solution I have found yet, is to implement a fixed number of
> `List<Advert>` typed properties on `Rotation` and extend the mapping
> with a `<list>` element for each:
>
>    <list name="Variant1" table="RotationAdvert" where="Variant = 1">
>        <key column="RotationID"/>
>        <index column="Position"/>
>        <many-to-many class="Advert" column="AdvertID"/>
>    </list>
>
>    <list name="Variant2" table="RotationAdvert" where="Variant = 2">
>        <key column="RotationID"/>
>        <index column="Position"/>
>        <many-to-many class="Advert" column="AdvertID"/>
>    </list>
>
>    etc...
>
> However, this requires me to specify a fixed number of variants, which
> I really would like to avoid.
>
> What are my other options? Can I squeeze a `RotationVariant` class
> into the model - without creating new tables in the database - and
> somehow map a `List<RotationVariant> ` property on `Rotation`? Or will
> I have to create a new table in the database, just to hold an ID for
> each `RotationVariant`?
>
> --
>
> 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.
>
>
>

--

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