Okay, so yesterday I managed to get the latest trunk builds of NHibernate and FluentNHibernate to work with my latest little project. (I\'m working on a bug tracking applica
It's not widely known, but you can set many conventions from the Mappings section in your Configure code e.g.
Fluently.Configure()
.Database(/* database config */)
.Mappings(m =>
{
m.FluentMappings
.AddFromAssemblyOf()
.Conventions.Add(PrimaryKey.Name.Is(x => "ID"));
})
to set a Primary Key convention.
Edit: Clarification of what the PrimaryKey convention does:
The PrimaryKey convention is used to specify what the column of the primary key is, not the property. Discovering the property is a pure automapping exercise, while conventions are applied to ClassMaps and automappings. – James Gregory
This is the list of supported conventions (from the wiki):
Table.Is(x => x.EntityType.Name + "Table")
PrimaryKey.Name.Is(x => "ID")
AutoImport.Never()
DefaultAccess.Field()
DefaultCascade.All()
DefaultLazy.Always()
DynamicInsert.AlwaysTrue()
DynamicUpdate.AlwaysTrue()
OptimisticLock.Is(x => x.Dirty())
Cache.Is(x => x.AsReadOnly())
ForeignKey.EndsWith("ID")
See The Simplest Conventions section on the FNH wiki.