I agree that this approach would work, but I was hoping it wouldn't be
necessary.

There's a very subtle different between ItemE and ItemD and so
segregating them via the ItemTypeID makes sense, but in terms of
properties, logic etc. they are functionally the same.

Any other suggestions?



On Jan 30, 3:38 am, cliff vaughn <[email protected]> wrote:
> create a 5th class:
>
> public class ItemE : ItemD
> {
>
> }
>
> your example would suggest there's reason for it and probably some behavior
> that could be in this new class.
>
>
>
> On Fri, Jan 29, 2010 at 11:24 PM, mbag <[email protected]> wrote:
> > I'm having trouble mapping the following setup in FNH.  Any help would
> > be appreciated.
>
> >        /***** Classes for Item Hierarchy  *****/
>
> >        public class ItemA
> >        {
> >                public string AProperty { get; set; }
> >        }
>
> >        public class ItemB : ItemA
> >        {
> >                public string BProperty { get; set; }
> >        }
>
> >        public class ItemC : ItemB
> >        {
> >                public string CProperty { get; set; }
> >        }
>
> >        public class ItemD : ItemB
> >        {
> >                public string DProperty { get; set; }
> >        }
>
> >        /***** Tables for Item Hierarchy  *****/
>
> >        TABLE A (ItemID INT, ItemTypeID INT, AProperty VARCHAR(100))
> >        TABLE A (ItemID INT, ItemTypeID INT, BProperty VARCHAR(100))
> >        TABLE A (ItemID INT, ItemTypeID INT, CProperty VARCHAR(100))
> >        TABLE A (ItemID INT, ItemTypeID INT, DProperty VARCHAR(100))
>
> >        /***** ItemTypeID to Class  *****/
>
> >        ItemTypeID = 1 --> ItemA
> >        ItemTypeID = 2 --> ItemB
> >        ItemTypeID = 3 --> ItemC
>
> >        ItemTypeID = 4 --> ItemD
> >        ItemTypeID = 5 --> ItemD
>
> >        /***** ItemTypeID to Table  *****/
>
> >        ItemTypeID = 1 --> Data is in Table A
> >        ItemTypeID = 2 --> Data is in Table A Join B
> >        ItemTypeID = 3 --> Data is in Table A Join B Join C
>
> >        ItemTypeID = 4 --> Data is in Table A Join B Join D
> >        ItemTypeID = 5 --> Data is in Table A Join B Join D
>
> > I would like to use a Discriminator column (ItemTypeID) but the
> > SubClassMap<ItemD> would have to accept either a value of 4 or 5.  Is
> > this possible?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<fluent-nhibernate%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.
>
> --
> thanks
>
> cliff

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.

Reply via email to