Я не могу вообразить, как это ускорило бы производительность. По-моему, всегда легче прокрутить/вниз, чем слева/справа.
Для быстрой реализации ..
public class AutoPersistenceModelGenerator : IAutoPersistenceModelGenerator
{
public AutoPersistenceModel Generate()
{
var mappings = new AutoPersistenceModel();
mappings.AddEntityAssembly(typeof(User).Assembly).Where(GetAutoMappingFilter);
mappings.Conventions.Setup(GetConventions());
.....
private Action<IConventionFinder> GetConventions()
{
return c =>
{
c.Add<PrimaryKeyConvention>();
c.Add<ReferenceConvention>();
c.Add<HasManyConvention>();
c.Add<TableNameConvention>();
......
public class TableNameConvention : IClassConvention
{
public void Apply(FluentNHibernate.Conventions.Instances.IClassInstance
instance)
{
instance.Table(Inflector.Net.Inflector.Pluralize("Portal_" +
instance.EntityType.Name));
}
}
Вы можете реализовать свою собственную INamingStrategy и указать ее для своей конфигурации:
Configuration config = new Configuration();
config.SetNamingStrategy(new MyTablePrefixStrategy());