Hi,
I want to insert a record through fluent, where a column need to have the value of getdate() sql function. How to do this in a single fluent save function?
Thanks,
Hi,
I want to insert a record through fluent, where a column need to have the value of getdate() sql function. How to do this in a single fluent save function?
Thanks,
You can do this with an IPreInsertEventListener implementation. They can be registered in Fluent NHibernate like this:
// Set event listeners for maintaining audit fields
var preInsertListeners = new IPreInsertEventListener[] {new AuditEventListener()};
var preUpdateListeners = new IPreUpdateEventListener[] {new AuditEventListener()};
fluentConfig.ExposeConfiguration(c => c.EventListeners.PreInsertEventListeners = preInsertListeners);
fluentConfig.ExposeConfiguration(c => c.EventListeners.PreUpdateEventListeners = preUpdateListeners);