It might work with an explicit Any-Property in D. You must never
forget that even unidirectional relations are relations. And on the
database, one-to-many relations are implemented with FKs on the
one-side, regardless of whether AR hides that from the model or not.

-Markus

2009/5/27 Hexedit <jasonsz...@gmail.com>:
>
> I apologize I worded my first message improperly. D should have no
> knowledge
> of the Entities A, B or C. In my object there is no Property for
> linking back to
> any one of the other entities. So it is a one sided HasMany with no
> related BelongsTo.
> I suppose an Any tag would work well in this situation but I'm not
> sure how to configure
> it or if it even works with a HasMany on the other side of the
> relation. Assuming that
> my domains A, B, and C never have conflicting integer primary keys,
> this shouldn't be
> an issue correct?
>
> On May 27, 10:56 am, Markus Zywitza <markus.zywi...@gmail.com> wrote:
>> You have A, B and C pointing to D: Ergo, D has an implicit many-to-one
>> to A, B and C, which is hidden in AR due to the unidirectional
>> relation. Now you want that D only has one many-to-one connection,
>> which will direct to A, B or C. This seems impossible: How should AR
>> know from an integer to which of the classes A, B or C it belongs? If
>> you use Identity, the same key might be used in A, B and C, leaving AR
>> clueless of what to load.
>>
>> You need three FK columns in D if A, B and C are not related. If they
>> belong to the same base class, you can define the HasMany there, but
>> with unrelated classes your scenario is impossible.
>>
>> -Markus
>>
>> 2009/5/27 Hexedit <jasonsz...@gmail.com>:
>>
>>
>>
>> > I have three unique entity classes that each have a collection of a
>> > fourth entity via the HasMany attribute. The mappings should be one-to-
>> > many unidirectional relationships from entities A, B, and C to entity
>> > D. Each HasMany attribute references the same table and the same
>> > column for the foreign key. Since the referenced column is an integer
>> > it should not matter that it could be pointing to objects from 3
>> > tables. The problem is that the generation tool non-deterministically
>> > picks one of the first three entities and creates a foreign key
>> > relationship from the reference column in the 4th entity table to the
>> > entity that owns that relation. Is there any way for me to override
>> > this behavior and make it so that the Many side of the HasMany
>> > relationship doesn't foreign key back to the first table?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-users@googlegroups.com
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to