You could use an interceptor, override AfterTransactionBegin, and store the
current time somewhere.

I'm also doing auditing with IPostInsert/Delete/Update listeners, but we
also have an audit "header" (per transaction or sub-transaction), so I
explicitly set that when beginning the transaction.

   Diego


On Fri, Feb 5, 2010 at 15:01, Michael diSibio <[email protected]>wrote:

> Hi Diego - how goes it!
>
> I am writing an audit component by implementing persistence event
> listeners (such as IPostInsertEventListener).
> The properties of the listener expose the IEventSource which has this
> "Timestamp" property.
> My goal was: rather than just use "DateTime.Now" within the audit
> component as a "TransactionStart" timestamp (which is fine if nothing
> else is available)
> I thought I could be more specific if NHibernate was tracking the
> system time of when the actual ITransaction was instantiated.
> Thus, if for some reason the actual transaction is part of a long-
> running conversation, the time I capture for audit would be more
> accurate, and not represent simply the time of the
> Flush() to the database.
> Since the documentation says "System time before the start of the
> transaction", I thought that was exactly what I was looking for.
>
> Thanks for looking into it, anyways.
>
> On Feb 5, 9:14 am, Diego Mijelshon <[email protected]> wrote:
> > Hi Mike! :-)
> >
> > From reading the source code, it seems like that value is coming from the
> > Cache provider, and might mean anything.
> > What are you trying to accomplish?
> >
> >    Diego
> >
> >
> >
> > On Thu, Feb 4, 2010 at 17:52, mdisibio <[email protected]>
> wrote:
> > > The API documentation says: "System time before the start of the
> > > transaction."
> >
> > > I was hoping it was an actual timestamp of when the transaction
> > > started, and not a database row timestamp.
> >
> > > However, when I capture the value (long) and feed it to the DateTime
> > > constructor, I get a date value only a few hours from
> > > DateTime.MinValue
> >
> > > Since I could not find any more info via Google, can someone please
> > > clarify its use.
> >
> > > Thanks - Mike
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "nhusers" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>
> ­>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to