1

I have a model library that I want to automatically build its NHibernate mappings using FluentNhibernate. There's a convention that I'd like to add to this model and that is each table name ends with 's'. So here's what I do :

new AutoPersistenceModel()
            .AddEntityAssembly(typeof(User).Assembly)
            .Conventions.Add(typeof(ClassConvention))
            .WriteMappingsTo(@"E:\Temp\");

Here's the code of ClassConvention :

private class ClassConvention:IClassConvention
    {
        public void Apply(IClassInstance instance)
        {
            instance.Table(instance.EntityType.Name+"s");
        }
    }

but it simply doesn't work.No table attribute is added to class tag when I run this code. Please help me understand what's wrong with my code ?

Update:

I have debugged my code and I am sure that this line :

instance.Table(instance.EntityType.Name+"s");

is called.

Beatles1692
  • 5,214
  • 34
  • 65

1 Answers1

0

Your convention defining class should be public not private