I have same problem: sharparch + Parent - child relationship with my object tree that derives from Entity -> joined-class tables are not pluralized. As I read in this and "IJoinedSubClassConvention never called" post, I added the convention implementation as:
----------------------------------------------------------------------------------------------- public class JoinedSubClassConvention : IJoinedSubclassConvention { public bool Accept(IJoinedSubclass target) { return true; } public void Apply(IJoinedSubclass target) { target.WithTableName(Inflector.Net.Inflector.Pluralize (target.EntityType.Name)); } } ----------------------------------------------------------------------------------------------- Then I updated my project with the latest build of FluentNhibernate from the trunk. I noticed that AutoJoinedSubClassPart class is still is corrected: ----------------------------------------------------------------------------------------------- public class AutoJoinedSubClassPart<T> : AutoMap<T>, IJoinedSubclass void IJoinedSubclass.WithTableName(string tableName) { throw new NotImplementedException(); } ----------------------------------------------------------------------------------------------- so I changed this into: ----------------------------------------------------------------------------------------------- void IJoinedSubclass.WithTableName(string tableName) { WithTable(tableName); } ----------------------------------------------------------------------------------------------- recompiled against NH 2.1 and added binaries to my project. I added the new convention and my auto generator looks like: ----------------------------------------------------------------------------------------------- public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator { public AutoPersistenceModel Generate() { AutoPersistenceModel mappings = AutoPersistenceModel // If you delete the default class, simply point the following line to an entity within the .Core layer .MapEntitiesFromAssemblyOf<PowerPlant>() .Where(GetAutoMappingFilter) .ConventionDiscovery.Setup(GetConventions()) .WithSetup(GetSetup()) .UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator> (); return mappings; } private Action<AutoMappingExpressions> GetSetup() { return c => { c.FindIdentity = type => type.Name == "Id"; c.IsBaseType = IsBaseTypeConvention; }; } private Action<IConventionFinder> GetConventions() { return c => { c.Add<PrimaryKeyConvention>(); c.Add<ReferenceConvention>(); c.Add<HasManyConvention>(); c.Add<TableNameConvention>(); c.Add<JoinedSubClassConvention>(); }; } /// <summary> /// Provides a filter for only including types which inherit from the IEntityWithTypedId interface. /// </summary> private bool GetAutoMappingFilter(Type t) { return t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IEntityWithTypedId<>)); } private bool IsBaseTypeConvention(Type arg) { bool derivesFromEntity = arg == typeof(Entity); bool derivesFromEntityWithTypedId = arg.IsGenericType && (arg.GetGenericTypeDefinition() == typeof (EntityWithTypedId<>)); return derivesFromEntity || derivesFromEntityWithTypedId; } } ----------------------------------------------------------------------------------------------- This however doesn't generate pluralized table names for my joined- subclass entities, however either accept and apply are being hit for the correct class! I generate the schema like: ----------------------------------------------------------------------------------------------- var config = NHibernateSession.Init( new SimpleSessionStorage(), mappingAssemblies, new AutoPersistenceModelGenerator().Generate(), @"IntegrationTestsConfiguration \NHibernate_SqlServer2005.config"); // Generates tables from schema new NHibernate.Tool.hbm2ddl.SchemaExport(config).Create (true, true); ----------------------------------------------------------------------------------------------- I know it's a lot of code that I vomit here (extremely sorry) but I wasted half a day on searching for the solution and I'm still stuck on this. Could anybody point me where am I wrong ? many thanks, Łukasz Podolak On 27 Maj, 12:10, Rui Silvestre <rui.silves...@gmail.com> wrote: > Hi Martin, > > you have a point there, I have limited knowledge of FNH... work in > progress... > yes, I had the class convention and was thinking it would work,,, It > didn't so I searched some more and found a thread > ("IJoinedSubClassConvention never called") which explained nicely what > to do. I downloaded the code from svn and found out that your patch > was not applied so I did it, recompiled FNH, recompiled Sharp with the > library and my project worked. > > this is a sensible point as I saw a lot of threads on the internet > about this issue. > > thank you all for the help. > > On 27 Maio, 09:25, "Martin Hornagold" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---