James,

 

Followed the mapping through the debugger today.

As I am using automapping, my joined subclass is an
AutoJoinedSubClassPart.

This only implements IMappingPart and not IJoinedSubclass currently
which means the convention is not applied.

 

Here is a patch to fix. Would be grateful if you could apply it to the
trunk

 

Martin

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Martin
Hornagold
Sent: 25 March 2009 12:55
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: IJoinedSubClassConvention never called

 

Person is a class as I have set my IsBaseType to be either
BaseEntityWithTypedId <> or BsaeEntity

Author should be a JoinedSubClass.

The AutoMapper correctly maps Person as a class and Author as a
JoinedSubclass when I output the mappings.

 


From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: 25 March 2009 12:11
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: IJoinedSubClassConvention never called

 

Hmm, are these definitely joined-subclasses and not regular subclasses?

On Wed, Mar 25, 2009 at 12:04 PM, Martin Hornagold <
martin.hornag...@marstangroup.com> wrote:

James,

 

The only other thing of note is that my initial description of the
inheritance hierarchy is slightly lacking.

 I have my own Base classes which inherit from EntityWithTypedId from
S#arp so the actual inheritance hierarchy is as follows:

 

SharpArch.Core.EntityWithTypedId<T>

    |

BaseEntityWithTypedId<T>

    |

BaseEntity : BaseEntityWithTypedId<int>

    |

Person

    |

Author

 

 

Martin

 

From: fluent-nhibernate@googlegroups.com [mailto:
fluent-nhibern...@googlegroups.com] On Behalf Of Martin Hornagold
Sent: 25 March 2009 11:58


To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: IJoinedSubClassConvention never called

 

James,

 

Just tried adding the convention explicitly to rule out a discovery
problem and it still never gets called.

 

Martin

 

From: fluent-nhibernate@googlegroups.com [mailto:
fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: 25 March 2009 11:25
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: IJoinedSubClassConvention never called

 

Hey Martin,

 

Could you show me your convention code, and how you're adding them?

 

I've just written a test that verifies that joined subclass conventions
do get applied, so I think you've either got it setup wrong, or you've
hit a bug I haven't been able to replicate.

 

My test is this:

 

[Test]

public void ShouldApplyJoinedSubclasses()

{

    new MappingTester<ExampleClass>()

        .Conventions(x => x.Add<ExampleJoinedSubclassConvention>())

        .ForMapping(m => m.JoinedSubClass<ExampleInheritedClass>("test",
m2 => { }))

        .Element("class/joined-subclass").HasAttribute("test", "true");

}

 

private class ExampleJoinedSubclassConvention :
IJoinedSubclassConvention

{

    public bool Accept(IJoinedSubclass target)

    {

        return true;

    }

 

    public void Apply(IJoinedSubclass target)

    {

        target.SetAttribute("test", "true");

    }

}

 

On Tue, Mar 24, 2009 at 10:28 AM, Martin Hornagold <
martin.hornag...@marstangroup.com> wrote:


FYI, I just tried removing the override and it still never gets called.


-----Original Message-----
From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of Martin
Sent: 24 March 2009 10:15
To: Fluent NHibernate
Subject: [fluent-nhib] IJoinedSubClassConvention never called


Hi,

I have the following class structure:

BaseEntity
     |
Person
     |
Author

The mapping all works out perfectly, Person is mapped as a class with
the Id inherited from the base class, and Author is set as a
JoinedSubClass.
The problem is that my project has a convention of pluralised table
names.
My class convention is called to pluralise Person, but my
JoinedSubClass convention never gets called when running through the
debugger.
I have an override class for person to set a component, but this
shouldn't affect the JoinedSubClass convention should it?
Has anyone else successfully used IJoinedSubClassConvention?



 

 

 

 

 

 

 



 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Attachment: AutoJoinedSubClassPart.patch
Description: AutoJoinedSubClassPart.patch

Reply via email to