Although you haven't shown it, I'm assuming you're using the Subclass mapping strategy for your subclasses, so each subclass has it's own table. To change the table names of subclasses, you'll need to implement an ISubclassConvention, which is pretty much the same thing as an IClassConvention except for subclasses. You should be able to change your TablePrefixConvention to implement both interfaces.
On 12/7/09, Hadi Eskandari <[email protected]> wrote: > I'm having an inheritance model like this: > > abstract class EntityBase > abstract class Person : EntityBase > class Personnel : Person > class AppUser : Person > > when doing the mapping, I'm using EntityBase as layer-supertype so > there's no table for Entitybase in database. each other class is > mapped to a table. > > my mapping code is this: > > AutoMap.AssemblyOf<Person>() > .Where(t => typeof (EntityBase).IsAssignableFrom(t)) > .Conventions.Setup(s => > { > s.Add<TablePrefixConvention> > (); > // > s.Add<ForeignKeyNameConvention>(); > }) > .IncludeBase<Person>() > .IgnoreBase<EntityBase>(); > > Now, I want to use ForeignKey / Table conventions to customize > database generations and it does not work for inherited tables. > > public class TablePrefixConvention : IClassConvention{ > public void Apply(IClassInstance instance){ > instance.Table("tbl_" + instance.Entity.Name); > } > } > > ...I end up with : AppUser, tbl_Person, Personnel > > I tried a ForeignKeyConvention to change the ForeignKey fields, also > it is causing me other issues. > > Is this a known issue? Any workarounds? I'm using version 1.0 of FNH. > > -- > > 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. > > > -- 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.
