-->
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.  [ 3 posts ] 
Author Message
 Post subject: Default Constructor question
PostPosted: Wed May 14, 2008 11:16 am 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
I have a private constructor that does following
Code:
 
     private Invoice()
        {
            OnAfterCreate();

            _lineItems = new Bag<billing.LineItem>();

            lineItems.ItemAdded += new EventHandler<CollectionChangedEventArgs<billing.LineItem>>(lineItems_ItemAdded);
            lineItems.ItemRemoved += new EventHandler<CollectionChangedEventArgs<billing.LineItem>>(lineItems_ItemRemoved);
         

        }


but when I am debugging I do not see this constructor being called at all by NH. It loads invoices, and everything is there but this constructor never gets call, or at least I am not seeing it in debug mode. Also, collection does not have event handlers attached (I created my own IUserCollectionType and PresistentBag implementation, and that works fine).

So what is going on here?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 12:06 pm 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
After restarting the project, I can debug it now, but I am loosing my event handlers. Nothing shows as attached. Anybody knows why?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 14, 2008 12:13 pm 
Regular
Regular

Joined: Tue Oct 16, 2007 9:45 am
Posts: 93
I solved the problem. I moved handler attaching to the property setter and modified mapping file not to access it through private field. Now it fires event and everything works fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.