James,

 

I am using S#arp Architecture so conventions  are added through the
AutoPersistenceModelGenerator as from the S#arp arch template.

Other conventions are working fine and discovered in the same namespace,
but when I debug my mapping integration test this one never gets hit.

 

My convention is simple, just a pluralizer:

 

public class JoinedSubClassTableNameConventions :
IJoinedSubclassConvention

 {

        public bool Accept(IJoinedSubclass target)

        {

            return true;

        }

 

        public void Apply(IJoinedSubclass target)

        {

 
target.WithTableName(Inflector.Net.Inflector.Pluralize(target.EntityType
.Name));

        }

    }

 

As I said I do have an override on the parent class Person to set my
Name component (due to the need to ignore a property).

But when excluding the override the problem still exists.

It is wierd.

 

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

Reply via email to