I have a Custom EventListener hooked into listen for SaveOrUpdates and now whenever I call Session.SaveOrUpdate on my object it inserts when it should update.
Here is my Event Listener:
public class CustomSaveEventListener : DefaultSaveEventListener
{
protected override object PerformSaveOrUpdate(SaveOrUpdateEvent @event)
{
return base.PerformSaveOrUpdate(@event);
}
}
Here is how it is configured (fluently):
SessionFactory = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.Is(connString)).ShowSql().DoNot.UseReflectionOptimizer)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<INC_IncidentMap>())
.ExposeConfiguration(c => c.EventListeners.SaveOrUpdateEventListeners = new ISaveOrUpdateEventListener[] { new CustomSaveEventListener() })
.BuildConfiguration().BuildSessionFactory();
The reason I need the event listener is because I need to perform audit tracking on any/every entity persisted.
Has anyone ran into this issue? Any insight would be greatly appreciated.