My specific reason for my original design was to incorporate recursion
into workflows.

Meaning that a root SerialWorkflow would have any number of
IWorkflowSteps (Which could be a Reviewer, SerialWorkflow, or
ParallelWorkflow concrete class). If one of the IWorkflowSteps was a
SerialWorkflow or ParallelWorkflow, it would also have any number of
IWorkflowSteps (etc.). There are multiple ways to model this, and I
was looking at it from how *I* would model it in the database first,
and then developing my Objects around that.

That meant that I would actually have another interface, IWorkflow,
which would inherit from IWorkflowStep, and from which SerialWorkflow
and ParallelWorkflow would inherit. This would give me three tables
(WorkflowSteps = IWorkflowStep, Reviewers = Reviewer, and Workflows =
IWorkflow). This allowed me to discriminate on two levels, instead of
one. As is, I need FOUR tables to do what three could... and this is
just me being hard nosed about how I want my DB to look with this
design, but I'd rahter have the three.

The other option of course, is to simply eliminate the SerialWorkflow
and ParallelWorkflow distinction and instead simply put a boolean
value in the Workflow class for IsParallel or some such thing, which
is a possibility since they don't have any SPECIFIC differences in
terms of behavior that I couldn't handle that way instead of by
class... And then I'm back to three tables.

For my specific case, it just would have fit my preconceived idea of
how the DB and objects should look and interact if there was a way to
discrimate beyond the first level. Yes, it could get very ugly and
inefficient if used wrong, but anything used wrong runs that risk.

==

I am still told that this is possible in NHibernate, but I haven't
seen the docs that he found on it. Just wanted to state my original
thoughts on why it WOULD be what I wanted in this certain scenerio.

/Michael

On Aug 19, 6:03 pm, Hudson Akridge <[email protected]> wrote:
> As far as I'm aware, you cannot have mixed NH Inheritance mapping. It's not
> a fluent limitation, I've just never heard of it being done with NH, and
> pretty sure that it does not offer support for that scenario. If you think
> about it, it would be pretty chaotic, very quick, especially if you go back
> and forth. That's honestly a level of complication that's probably horrible
> in terms of performance, and very difficult to write support for.
> Really, I'd have to ask what the purpose of such a request would be? There's
> no reason either a joined subclass, or standard subclass mapping using
> discriminators wouldn't work for pretty much every scenario I can think of.
>
>
>
> On Wed, Aug 19, 2009 at 4:26 PM, Beefy <[email protected]> wrote:
>
> > This is another issue I was having that I couldn't find a way around,
> > at least not and still maintain the DB / Entity model I wanted.
>
> > I was told that NHibernate does support this sort of inheritance
> > though... but he may have been mistaken. Fluent NHibernate certainly
> > didn't. My model was for workflows, where by there was a root level
> > WorkflowStep, and then each step could be one of Reviewer or Workflow
> > (Which could be a ParallelWorkflow or SerialWorkflow). I accomplished
> > this by having everything inherit from WorkflowStep (instead of having
> > WorkflowStep > Workflow > Parallel or SerialWorkflow).
>
> > The downside to that was that I needed an extra database table, which
> > I'm betting is what you're trying to avoid (Unless your inheritance
> > structure is deeper in depth than mine...). My solution required that
> > there be a table-per-entity (Reviewers, ParallelWorkflows,
> > SerialWorkflows) as well as a top end WorkflowStep table. What I
> > WANTED was three tables (Reviewers, Workflows, and WorkflowSteps)
> > instead of four. This would require a discriminator on the Subclass
> > Workflow for determining whether to make it a Serial or
> > ParallelWorkflow entity though, which Fluent NHibernate just doesn't
> > do unfortunately.
>
> > If there IS a way to map this in NHibernate, and we can get it into a
> > future version of Fluent NHibernate, that would be great! I'd put my
> > vote in for it!
>
> > On Aug 19, 4:09 am, Mikael Henriksson <[email protected]> wrote:
> > > Thanks David I'll try that after work would have yesterday but I was too
> > > tired to try crazy ideas. ;)
>
> > > On Wed, Aug 19, 2009 at 9:39 AM, David Perfors <[email protected]>
> > wrote:
>
> > > > What I did in some cases whas to make a Base class map like:
> > > > class Person<T> : ClassMap<T>
> > > > {
> > > > }
>
> > > > and the subclasses inherit from Person<T> instead of ClassMap<T> That
> > > > whay you still have the power of OO subclasses,
> > > > but the database see it as two different tables...
>
> > > > (not sure if this is what you want though...)
>
> > > > David Perfors.
>
> > > > On Aug 19, 9:00 am, Mikael Henriksson <[email protected]> wrote:
> > > > > Gaaah all these limitations everywhere :)
> > > > > Not that I care about the database it's just frustrating that I can't
> > > > make
> > > > > it perfect!! Not saying it's your fault James, just saying that's
> > all.
> > > > I'll
> > > > > try to make it work in a different manner. What I was actually trying
> > to
> > > > > accomplish was to not have to repeat myself too much. So this would
> > be my
> > > > > next step. Can't I just use the same ClassMap for these guys?.
> > > > > On Tue, Aug 18, 2009 at 9:56 PM, James Gregory <
> > [email protected]
> > > > >wrote:
>
> > > > > > I assume what you're trying to do is have a Person table, and a
> > > > > > BoardMembers table, with BoardMember being a joined-subclass, and
> > then
> > > > any
> > > > > > derived BoardMember's being discriminated...?
>
> > > > > > If that is the case, then I'm afraid you're out of
> > > > > > luck. Unless somebody knows otherwise, I'm pretty sure you can't do
> > > > that with NHibernate. You'll need them to all be in the same table and
> > call
> > > > DiscriminateSubclassesOnColumn in your ClassMap.
>
> > > > > > On Tue, Aug 18, 2009 at 8:42 PM, Mikael Henriksson <
> > > > [email protected]>wrote:
>
> > > > > >> I have many classes but only three is important for what I am
> > trying
> > > > to
> > > > > >> do.
> > > > > >> Let's say I have a person:
> > > > > >>     public class Person
> > > > > >>     {
> > > > > >>         public virtual int Id { get; private set; }
> > > > > >>         public virtual string FirstName { get; set; }
> > > > > >>         public virtual string LastName { get; set; }
> > > > > >>     }
>
> > > > > >> Now I want to inherit from person because a *board member *is a
> > > > person.
> > > > > >> but I have different types of board members that I want to
> > > > discriminate on
> > > > > >> for instance Chairman that inherits from BoardMember:
> > > > > >>     public class BoardMember : Person
> > > > > >>     {
> > > > > >>         public virtual Board Board { get; set; }
> > > > > >>         public virtual MemberTypes Type { get; set; }
> > > > > >>     }
>
> > > > > >>     public class Chairman : BoardMember
> > > > > >>     {
>
> > > > > >>     }
>
> > > > > >> Now I thought I would do something like:
> > > > > >> public class PersonMap : ClassMap<Person>
> > > > > >>  {
> > > > > >> public PersonMap()
> > > > > >> {
> > > > > >>  Table("person");
> > > > > >> Id(x => x.Id, "person_id");
> > > > > >> Map(x => x.FirstName, "person_first_name");
> > > > > >>  Map(x => x.LastName, "person_last_name");
> > > > > >> }
> > > > > >> }
>
> > > > > >>     public class BoardMemberMap : SubclassMap<BoardMember>
> > > > > >>     {
> > > > > >>         public BoardMemberMap()
> > > > > >>         {
> > > > > >>             Table("board_member");
> > > > > >>             Map(x => x.Type).Column("board_member_type");
> > > > > >>             DiscriminateSubclassOnColumn("board_member_type");
> > > > > >>         }
> > > > > >>     }
>
> > > > > >>      public class Chairman : SubclassMap<Chairman>
> > > > > >>     {
> > > > > >>         public Chairman()
> > > > > >>         {
>
> > > > > >>         }
> > > > > >>     }
>
> > > > > >> However DiscriminateSubclassOnColumn is not available within
> > > > SubclassMap
> > > > > >> so how do I work around it? :)
>
> --
> - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge
--~--~---------~--~----~------------~-------~--~----~
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