Please help? My NServiceBus endpoint is:
public class EndpointConfig : IConfigureThisEndpoint
{
public void Customize(BusConfiguration busConfiguration)
{
var windsorContainer = new WindsorContainer();
windsorContainer.Install(new IocInstaller());
busConfiguration.UseContainer<WindsorBuilder>(x => x.ExistingContainer(windsorContainer));
var nhConfiguration = new NHibernate.Cfg.Configuration();
nhConfiguration.Properties["connection.provider"] = "NHibernate.Connection.DriverConnectionProvider";
nhConfiguration.Properties["connection.driver_class"] = "NHibernate.Driver.Sql2008ClientDriver";
nhConfiguration.Properties["dialect"] = "NHibernate.Dialect.MsSql2008Dialect";
nhConfiguration.GetClassMapping(typeof(ProductAchievementMap));
busConfiguration.UsePersistence<NHibernatePersistence>().UseConfiguration(nhConfiguration);
busConfiguration.UseSerialization<XmlSerializer>();
}
}
My handler is:
public class ProductAchievementAuditCommandHandler : IHandleMessages<ProductAchievementAuditCommand>
{
public ISession Session { get; set; }
public void Handle(ProductAchievementAuditCommand message)
{
var productAchievementAudit = new ProductAchievement
{
Id = Guid.NewGuid(),
SapComId = message.SapComId,
MessageId = message.MessageId
};
Session.Save(productAchievementAudit);
}
}
My fluent mapping is:
public class ProductAchievementMap : ClassMap<ProductAchievement>
{
public ProductAchievementMap()
{
Table("ProductAchievementMessage");
Id(x => x.Id);
Map(x => x.SapComId);
Map(x => x.MessageId);
}
}
The error I'm getting is:"ERROR NServiceBus.GenericHost Exception when starting endpoint. System.InvalidOperationException: No NHibernate properties found in your config". According to the documentation I need to use busConfiguration.UsePersistence<NHibernatePersistence>().RegisterManagedSessionInTheContainer();
. To get public ISession Session { get; set; }
in the handler. How do I get the fluent mapping to work? Any help greatly appreciated.