I don't say that this is the job of the persistence layer. I want to
implement it in our business domain. I don't want to implement this
property setters, I want to compare with the state in the database,
this is just another approach to write audit logs. The problem is, I
just couldn't find ANY reasonable way to do this with NHibernate.

PS:  We used to have this kind of changed-event based logs in another
project. It could result in unwanted results when the user changes a
value several times, or back to the old value. You can recognize all
this, but it's hard work. It requires you to know the old value - and
here we are again. Of course I could keep the old value in a cache
after retrieving it from the database. I just wanted to avoid such
things.

On 24 Nov., 18:24, Jon Stelly <[EMAIL PROTECTED]> wrote:
> I'm with Fabio, this doesn't seem like a job for your persistence
> layer.  I would view an audit log as business functionality.  I'm
> starting work on my audit logging system, and I'm leaning towards a
> ChangeScope class that behaves somewhat like a TransactionScope and a
> simple helper method that I call in all of my property setters that
> adds an entry to this change scope.  Obviously that's a lot of code,
> so I'm also looking at writing a Guidance Automation Package to handle
> a lot of the work of ensuring all properties have the audit log call
> in them, etc...
>
> -Jon
>
> On Nov 24, 10:09 am, Stefan Steinegger <[EMAIL PROTECTED]> wrote:
>
> > I doubt that I'll be happy with Merge. Let's assume I have a complex
> > object graph to store, it is sent by the client to the server. I have
> > to store it and send it back. Assumed that many objects in the graph
> > are not stored by cascades, I have to store them separately. if I
> > would use Merge, I would get new instances of this objects and have to
> > *replace* them in the object graph. That's very bad. This produces at
> > least a lot of terrible code in the business logic.
>
> > Isn't there _any_ possibility to work with NHibernate how it is
> > supposed to be used _and_ get the current value from the database?
>
> > On 11 Nov., 15:03, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
>
> > > Try using Merge.
>
> > > --
> > > Fabio Maulo- 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]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to