I have a application using NHibernate Auto Mapping... All working fine so far...
My Fluent Global.asax config:
private void InitializeNHibernateSession()
{
NHibernateSession.Init(
webSessionStorage,
new string[] { Server.MapPath("~/bin/Proj.Data.dll") },
new AutoPersistenceModelGenerator().Generate(),
Server.MapPath("~/NHibernate.config"));
}
But I need to map a class with Fluent mapping... I created the class :
namespace Proj.Data.NHibernateMaps
{
public class CategoryMap : IAutoMappingOverride<Category>
{
public void Override(AutoMapping<Category> mapping)
{
mapping.Id(x => x.Id)
.GeneratedBy.Identity();
mapping.Map(x => x.Description);
mapping.Map(x => x.UrlName);
mapping.References(x => x.ParentCategory)
.Not.LazyLoad();
}
}
}
The problem is that this mapping is never used by the NHibernate... Instead it uses the Auto Mapping generated Category...
How can I use my Fluent Mapping ?
Thanks
Paul