These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Winform cancel strategy
PostPosted: Thu Jan 04, 2007 3:11 pm 
Beginner
Beginner

Joined: Sun Oct 22, 2006 12:06 pm
Posts: 39
Hi!

Since in winform data binding updates object values after format event (exiting from control) and when another control after that needs to load the data from the database by using session.query...

In this scenario when user wants to cancel the data manipulation then how to tell to NHibernate DO NOT UPDATE the data by loading from the database but only on session.Flush();


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 1:23 am 
Regular
Regular

Joined: Tue Feb 21, 2006 9:50 am
Posts: 107
for this reason i avoid the databinding feature. Each of my forms implements a BindData() and UnbindData() method which do the task. It's more work but the big advantage is, that i have absolutely control over the databinding process.

You can control the save behavior of a session via the FlushMode property or via session.Evict(). You can set the FlushMode of a session to "never" which means that you are responsible to call session.Flush() by yourself. Session.Evict() gives you a chance to remove specific objects from the session cache.

Regards
Klaus


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 3:51 am 
Beginner
Beginner

Joined: Sun Oct 22, 2006 12:06 pm
Posts: 39
I did some research and found that n-level undo capability has developed in CSLA BusinessObject with source fully available.

now the problem is that NHibernate wants that all propertyes or funcitons are virtual, but is there some attribute that tells to NHibernate not to worry about this function or property?

in example
Code:
public class User:BusinesObject
{
...
}

public class BusinessObject
{

[NHibernateDontWorryIfThisIsNotVirtual]
public void BeginEdit()
{
...
}

[NHibernateDontWorryIfThisIsNotVirtual]
public void EndEdit()
{
...
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 4:46 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
No, there isn't.
You can turn off proxying or build your own on a per-class level.
There are very good reasons why you need to have all properties/methods as virtual.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 5:34 am 
Beginner
Beginner

Joined: Sun Oct 22, 2006 12:06 pm
Posts: 39
Ayende Rahien wrote:
You can turn off proxying or build your own on a per-class level.
There are very good reasons why you need to have all properties/methods as virtual.


Can I turn of proxying on a per-class level? I did not found any material about how to do that.

Could you specify the reason why all properties/methods should be virtual, even if they does not do anything with NHibernate mapping, but extend some logic that have nothing to do with hibernate ???

But it seems that the needet time to invested on solving this is much longer than just writeing the virtual statement, so I'm probably take the eazy way...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 7:00 am 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
<class lazy="false">

You need this because you might load a proxy of a type Animal, and when you resolve it you would get a type Dog.
This means that everything on the proxy has to be forwarded to the implementation. otherwise bad stuff happens, because the class invariants are broken.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.