sounds like a good idea.

fyi, that column is considered a discriminator column, for when you want to
look into how to make nhibernate hydrate the correct type of entity based
on the row type.


------
Joe Brockhaus
joe.brockh...@gmail.com
------------


On Fri, Jul 13, 2012 at 3:18 PM, Peter Forstmeier <
peter.forstme...@googlemail.com> wrote:

> Hi,
> and thanks to all.
> i think i will try one AddressTable and include a Addresstype enum.
>
> once again
> thanks
> Peter
>
> On 11 Jul., 22:07, Carl Bussema <carl.buss...@gmail.com> wrote:
> > I can't say I have a lot of experience with complicated inheritance
> > mappings, but I figured it was worth checking what the actual case
> driving
> > the current table-per-subclass strategy. TPH is often a lot simpler to
> > model, and sometimes I find people thinking they more classes or tables
> > when really they just need a simple enum :)
> >
> >
> >
> > On Wed, Jul 11, 2012 at 3:56 PM, Joe Brockhaus <fel0ni...@gmail.com>
> wrote:
> > > >> "Are there any real differences between the different types of
> Address?
> > > >> Could you just use ... "
> >
> > > AddressType would be required for table-per-hierarchy modeling/mapping
> of
> > > just addresses. (that means, many types of addresses in a single table)
> >
> > > But this doesn't solve the problem of which addresses belong to which
> > > parent.
> >
> > > If your parents are also modeled with table-per-hierarchy, it makes
> this
> > > task a bit more straightforward. It also allows you to ensure DB
> integrity
> > > through the use of foreign keys constraints.
> >
> > > -- In this optimal (for t-p-h) situation (and assuming addresses are
> not
> > > re-used) you only need to add the FK column to the address table and
> then
> > > reference this column in the HasMany(..) method.
> > > -- If your parents are instead split across multiple tables, you cannot
> > > have the FK constraint. You also need an additional column on the
> address
> > > table indicating which parent type/table the FK refers to. Or, instead
> of
> > > adding the extra column, you can ensure that PrimaryKeys in those
> multiple
> > > parent tables do not overlap. These non-optimal methods complicate the
> > > bi-directional mapping a bit, but it's still doable by using overrides
> and
> > > filters on your References mapping in the BaseAddressMap.
> >
> > > ------
> > > Joe Brockhaus
> > > joe.brockh...@gmail.com
> > > ------------
> >
> > > On Wed, Jul 11, 2012 at 2:58 PM, Carl Bussema <carl.buss...@gmail.com
> >wrote:
> >
> > >> Are there any real differences between the different types of Address?
> >
> > >> Could you just use
> >
> > >> public enum AddressType {
> > >>     CustomerHome,
> > >>     CustomerBilling,
> > >>     ProjectSite,
> > >>     ...
> > >> }
> >
> > >> public class Address : Entity {
> > >>    public string StreetNumber { get; set; }
> > >>    public string StreetName { get; set; }
> > >>     ...
> > >>    public AddressType AddressType { get; set; }
> > >> }
> >
> > >> public class Customer : Entity {
> > >>    public string FirstName { get; set; }
> > >>   ...
> > >>   public ICollection<Address> Addresses { get; private set; }
> > >> }
> >
> > >> On Wed, Jul 11, 2012 at 2:47 PM, Peter Forstmeier <
> > >> peter.forstme...@googlemail.com> wrote:
> >
> > >>> Hi,
> > >>> thanks to both of you.
> > >>> I see that my idea is very comlicated.
> > >>> Is there any better idea?
> >
> > >>> My endresult should look something like this:
> > >>> Customer
> > >>>      CustomerHomeAddress
> > >>>      CustomerBillingAddress
> > >>>      etc
> > >>> Project
> > >>>      ProjectSiteAddress
> > >>>      ProjectmailingAddress
> >
> > >>> Supplier
> > >>>     SupplieHomeAddress
> > >>>     etc
> >
> > >>> Peter
> >
> > >>> --
> > >>> You received this message because you are subscribed to the Google
> > >>> Groups "Fluent NHibernate" group.
> > >>> To post to this group, send email to
> fluent-nhibernate@googlegroups.com.
> > >>> To unsubscribe from this group, send email to
> > >>> fluent-nhibernate+unsubscr...@googlegroups.com.
> > >>> For more options, visit this group at
> > >>>http://groups.google.com/group/fluent-nhibernate?hl=en.
> >
> > >>  --
> > >> You received this message because you are subscribed to the Google
> Groups
> > >> "Fluent NHibernate" group.
> > >> To post to this group, send email to
> fluent-nhibernate@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> fluent-nhibernate+unsubscr...@googlegroups.com.
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/fluent-nhibernate?hl=en.
> >
> > >  --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Fluent NHibernate" group.
> > > To post to this group, send email to
> fluent-nhibernate@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > fluent-nhibernate+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibernate@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to