I'm using Fluent NHibernate to map my NHibernate models.
Now i came accros the problem, that I want to prefix all my tables with an underscore in some cases. So i can't just change the Table(...)
definition in my mapping, I have to do it from the outside.
What I've got so far:
Model:
class Foo
{
public virtual int Id { get; set; }
}
class FooMapping : ClassMap<Foo>
{
Table("foo_table");
Id(x => x.Id).Column("foo_id");
}
Somewhere in my controller:
/*...*/
if (yourehappyandyouknowit)
{
Fluently.Configure()
/*...*/
.Conventions.Add(Table.Is(x => "_" + x.TableName));
/*...*/
}
This allways puts out "foo_table" and not "_foo_table".
When I comment out the Table(...)
definition, it is working like a charm... But I need to have the Table(...)
set within the mapping.