Not at all.  The third options states:

The third option is to use table per subclass with unioned subclasses. This
time there is no separate table for base class, common columns are
specified in each table for subclass separately and subclass tables share
the same key generator. Mapping union subclasses with mapping-by-code is
fairly simple - we just need to map the class by inheriting from
UnionSubclassMapping<T> - no additional requirements or options.

On Thu, Oct 23, 2014 at 1:05 PM, Xaxa Urtiz <[email protected]>
wrote:

> So i need to have table which will contain the id, and the 2 other table
> will contain a foreign key to this id ?
> In my table OrderRepartition i will have foreign key to the base class
> table id ?
>
> so=>
> abstract class EntityBase
> {
>   int Id;
>   abstract Name {get;}
> }
> class Desk
> {
>    string DeskName;
>    override Name
>     {
>         return DeskName;
>     }
> //other properties
> }
> class Person
> {
>    string LastName;
>    string FirstName;
>    override Name
>     {
>         return FirstName+LastName;
>     }
> //other properties
> }
>
>
>
>
>
>
>
> Le jeudi 23 octobre 2014 17:18:41 UTC+1, fknebels a écrit :
>>
>> See here: http://notherdev.blogspot.com/2012/01/mapping-by-code-
>> inheritance.html
>>
>> You are going to want a Table per subclass with a union subclass.
>>
>> On Thu, Oct 23, 2014 at 12:09 PM, Xaxa Urtiz <[email protected]>
>> wrote:
>>
>>> Hello everybody,
>>> I have a problem with nhibernate mapping:
>>> I have a class Order which contain some "Entity repartition" it can be
>>> either a person or a desk, and there is one or more entity by order.
>>> Person and desk are totally unrelated so i have 2 mapping and 2 table in
>>> database, one for desk and one for person, in my object model i've created
>>> a class Order who contains a list of OrderRepartition who contains a
>>> percentage and an object which is an interface IEntity who can be a Desk or
>>> a Person.
>>> I've read about inheritance in nhibernate but each time it's about
>>> sharing the same table or a "super" table in database and i don't want that
>>> because these object are totally unrelated (the IEntity interface just
>>> contain a public property for "Name" and this property is calculated from
>>> other property of the object, it's not a data who is stored).
>>> What is the best solution in my case ? how can i implement this problem ?
>>> Thanks in advance.
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "nhusers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/nhusers.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to