What's wrong with the following setup? The Where filter on the AutoPersistanceModel does not appear to be working and the table name convention does not appear to be working either. The error I'm evenually getting is "The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'property' in namespace 'urn:nhibernate-mapping-2.2'. List of possible elements expected: 'meta, jcs-cache, cache, id, composite-id' in namespace 'urn:nhibernate-mapping-2.2'." Here's my code:
public ISessionFactory BuildSessionFactory()
{
return Fluently.Configure()
.Database(
OracleConfiguration.Oracle9.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString")))
.Mappings(m =>
{
m.AutoMappings.Add(GetAutoPersistanceModel);
m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly());
})
.BuildSessionFactory();
}
public AutoPersistenceModel GetAutoPersistanceModel()
{
return AutoPersistenceModel.MapEntitiesFromAssemblyOf<User>()
.Where(type => type.IsClass && !type.IsAbstract && type.Namespace == "Some.Namespace")
.ConventionDiscovery.Add<IConvention>(
Table.Is(x => "tbl" + x.EntityType.Name.Pluralize())
);
}