I've meant by "we back to where we start" that we should do it ourselves :)

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of FrederikGheysels
Sent: Monday, June 22, 2009 10:19 PM
To: nhusers
Subject: [nhusers] Re: deep copy aggregate root


I never said you should do it by hand ....
I've said: create a method that uses reflection .....  that is: a
generic method which you have to write only once and that you can use
for all your entities.

On 22 jun, 16:54, "Yevhen Bobrov" <[email protected]> wrote:
> Well, we back to where we start :)
> The guy (Tyler Burd) who started this discussion has written exactly about
> that:
>
> >> So far I'm copying all aggregate roots by hand, but that is tedious and
>
> error-prone.
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
>
> Of FrederikGheysels
> Sent: Monday, June 22, 2009 5:32 PM
> To: nhusers
> Subject: [nhusers] Re: deep copy aggregate root
>
> Well then, why not implement some undo - functionality that is based
> on reflection & serialization ?
> Create a BeginChanges, AcceptChanges and CancelChanges on your object.
> When you display the object using databinding, you call BeginChanges.
> When you want to cancel the changes, call CancelChanges so that the
> object's state is reverted ?
>
> In the BeginChanges method, you can find all fields using reflection,
> save their state in a hashtable, etc....
> When you Cancel the Changes, get the hashtable, loop over it, and set
> the values of all the fields back to the value that you find in the
> hashtable for that field ...   Offcourse, this is not so simple,
> especially with collections (I don't even know if it is possible out
> of the box, I think that you will have to create a user-type for
> NHibernate).
>
> On 22 jun, 15:39, "Yevhen Bobrov" <[email protected]> wrote:
> > Frederic, will all respect it is not viable to delay data binding in big
> > enterprise application with myriad of objects. This will require an
> enormous
> > amount of code to implement temporal storage of state for each object or
> > collection or reference. This what data binding for - to ease
manipulation
> > of object state. Either you will need to duplicate all validation logic
> and
> > all of behavior in your intermediate objects or dumb down screen to
stupid
> > "input form with DTO's underneath", as in this scenario you can't touch
> real
> > objects before commit.
> > Delaying modifications to object state is only a viable option for very
> > small apps.
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]] On
Behalf
>
> > Of FrederikGheysels
> > Sent: Monday, June 22, 2009 4:23 PM
> > To: nhusers
> > Subject: [nhusers] Re: deep copy aggregate root
>
> > Well, you can implement an N-level Undo functionality (like I referred
> > to in my post), or , you can 'delay' the databinding on your WinForms
> > app to get a solution for your problem.
> > My first idea was to implement N-level undo functionality (which I've
> > done) on my base-entity class, but after a little bit of playing with
> > it, I thought it was overkill.  (Some of my entities have associations
> > to other entities, etc...  so a lot of data would be serialized).
> > Next to that, I didn't want to make all my entities serializable, so I
> > came up with another solution; that is: delaying the 2-way
> > databinding.
> > This problem is not directly related to NH, although I do find it a
> > pity that NH commits the changes you made to an entity when you flush
> > the session, even if you did not call 'SaveOrUpdate' for that entity.
>
> > On 20 jun, 17:35, Yevhen Bobrov <[email protected]> wrote:
> > > It is. It is not about NH problem but about what happens when changes
> > > are applied directly to the object and there is need to cancel them.
> > > This is what happens in usual WinForms application.
>
> > > On 20 июн, 18:15, Fabio Maulo <[email protected]> wrote:
>
> > > > 2009/6/20 Yevhen Bobrov <[email protected]>
>
> > > > > BTW, Frederik talks about such kind of problem here
>
> >
>http://fgheysels.blogspot.com/2009/06/winforms-databinding-on-cancell...
>
> > > > That is not a post about a problem, that is a post about a UI
solution
> > and
> > > > as you can see there is no reference about the persistent-layer and
no
> > > > reference about the usage of Clone.
> > > > Frederik had the good spirit, even showing the n-level-undo
capability
> > of
> > > > CSLA (where, another time, the persistence-layer has nothing to do).
>
> > > > We'll wait your example showing your problem in detail; after have
it
> we
> > can
> > > > talk about a solution if you can't find it.
>
> > > > --
> > > > Fabio Maulo
>
> > __________ Information from ESET Smart Security, version of virus
> signature
> > database 4174 (20090620) __________
>
> > The message was checked by ESET Smart Security.
>
> >http://www.esetnod32.ru
>
> > __________ Information from ESET Smart Security, version of virus
> signature
> > database 4174 (20090620) __________
>
> > The message was checked by ESET Smart Security.
>
> >http://www.esetnod32.ru
>
> __________ Information from ESET Smart Security, version of virus
signature
> database 4174 (20090620) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.esetnod32.ru
>
> __________ Information from ESET Smart Security, version of virus
signature
> database 4174 (20090620) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.esetnod32.ru
 

__________ Information from ESET Smart Security, version of virus signature
database 4174 (20090620) __________

The message was checked by ESET Smart Security.

http://www.esetnod32.ru
 
 

__________ Information from ESET Smart Security, version of virus signature
database 4174 (20090620) __________

The message was checked by ESET Smart Security.

http://www.esetnod32.ru
 


--~--~---------~--~----~------------~-------~--~----~
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