Just looked into this, it seems overrides are being applied before
conventions. So the changes get overwritten by the conventions... The thread
you linked to is a bit of a bigger issue, but for this one I should just be
able to reorder when the overrides get applied.
An alternative is to not use overrides at all for this situation, as you're
not actually doing anything with the automappings. You could just write
another convention that's RegionTableNameConvention.

Still, I'll fix this either way.

On Tue, Mar 24, 2009 at 8:29 PM, James Gregory <[email protected]>wrote:

> Yep, something smelly is going on here. I'll investigate.
>
>
> On Tue, Mar 24, 2009 at 8:13 PM, Billy <[email protected]> wrote:
>
>>
>> Looks like this is related to the issue described at
>>
>> http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/b866ce932b2a4f89
>>
>> Incidentally, if I modify the class convention to ignore the Region
>> class, then the override works just fine; e.g.,
>>
>> public class TableNameConvention : IClassConvention
>> {
>>    public bool Accept(IClassMap classMap) {
>>         return classMap.EntityType != typeof(Region);
>>     }
>>
>>    public void Apply(IClassMap classMap) {
>>        classMap.WithTable(Inflector.Net.Inflector.Pluralize
>> (classMap.EntityType.Name));
>>    }
>> }
>>
>> But preferably, I don't want to have to put class exclusions within
>> the convention classes, I'd rather have the overrides always take
>> precedence.
>>
>> Billy
>>
>>
>> On Mar 24, 2:07 pm, Billy <[email protected]> wrote:
>> > Hi James,
>> >
>> > I'm updating S#arp Architecture's example project to the last and have
>> > made great progress.  In fact, the thing remaining is a problem I'm
>> > having with an override not "taking."
>> >
>> > I have the following class convention:
>> >
>> > public class TableNameConvention : IClassConvention
>> > {
>> >     public bool Accept(IClassMap classMap) {
>> >         return true;
>> >     }
>> >
>> >     public void Apply(IClassMap classMap) {
>> >         classMap.WithTable(Inflector.Net.Inflector.Pluralize
>> > (classMap.EntityType.Name));
>> >     }
>> >
>> > }
>> >
>> > I then have an override for a Region class as follows:
>> >
>> > public class RegionMap : IAutoMappingOverride<Region>
>> > {
>> >     public void Override(AutoMap<Region> mapping) {
>> >         mapping.WithTable("Region");
>> >         ...
>> >     }
>> >
>> > }
>> >
>> > The .WithTable in the override is not getting applied, although the
>> > other settings within the override are being applied just fine.  When
>> > I do a select for any region objects, the SQL is trying to query a
>> > table named Regions (which is compliant with the convention, but not
>> > with the override).
>> >
>> > Ideas?
>> >
>> > Thanks!
>> > Billy McCafferty
>> >>
>>
>

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