CSLA 1.5x for .Net2.0 listchaged/isdirty events remoting vs. non-remoting

CSLA 1.5x for .Net2.0 listchaged/isdirty events remoting vs. non-remoting

Old forum URL: forums.lhotka.net/forums/t/1832.aspx


Skeeboe posted on Saturday, November 25, 2006

Ugh!
I'm using CSLA .NET version 1.51 for .NET 2.0 RC0 as my base for all our work. We're looking to start Csla 2.1.1 with our newest project but for now I'm using 1.51 for .NET 2.0.

I have two events in a BO that listen for the isdirtychanged event (for the root) and the listchanged event for any of the children. If virtually any property changes in the root or children, I run a calculate function that returns an updated payment. This works great until we decided we want to look at remoting again.

With remoting turned on the events DO NOT FIRE on the client side. From testing I can see they do fire on the server side, but that doesn't help much.

I looked at 1.52 and 1.53 (which are still for .Net 1.1) and they mention "This is a minor update to verison 1.51 to fix some bugs with cascading events from child objects up through their parent collection." and 1.53 "This is a minor update to version 1.52 to fix some bugs with cascading events from child objects and serialization." Again these are based on .Net 1.1 and even still have the old c# code in there for bindingbase and bindingcollectionbase.

I looked through previous forum messages and saw http://forums.lhotka.net/forums/thread/4084.aspx. That is for Csla 2.0.3 though and doesn't address the same issue.

Does anyone have any code to address this issue? I appreciate all your help.

Skeeboe replied on Monday, November 27, 2006

Rocky, Anyone? Any help would be appreciated.

JonM replied on Monday, November 27, 2006

I'm using the CSLA.net 1.5x on .NET 2.0.  First of all I would strongly recommend making sure you are using the newest version 1.53.  Are you using the UpdateParent code blocks in your collections?

Skeeboe replied on Tuesday, November 28, 2006

I thought 1.53 was only for .net 1.1? I'm not familiar with the UpdateParent code.

Skeeboe replied on Monday, December 04, 2006

I downloaded 1.53 but its still appears to only be a .NET 1.1 product. Is there a 1.53 version set to work with .NET 2.0?

ajj3085 replied on Tuesday, December 05, 2006

Version 1.53 should work just fine with .Net 2.0. 

Does it no longer compile?

Per your original problem, it sounds like you need to hook up the events again after deserialization.  In 2.x you override OnDeserialized... in 1.53 it looks like you can override Deserialized.

So override it and be sure to call base.Deserialized first, and then hook up your event handlers again.

HTH
Andy

Skeeboe replied on Tuesday, December 05, 2006

When you download the 1.53 zip file and click on the solution, its in .NET 1.1 format, so .NET 2.0 wants to convert it. Whereas if you download the 1.51 for  for .NET RC0 (or Beta2) the solution is already in 2.0 format. Also the 2.0 versions don't have the C# code for binding, it was updated for the .Net2.0 style of binding. That of course is what I'm having an issue with. The listchanged and isdirty events fire in remoting but only on the server.

Where can I see code that I could use as a guide for overriding OnDeserialized?

ajj3085 replied on Tuesday, December 05, 2006

That's ok, just do the conversion.  I actually tried the conversion this afternoon, and except for the web sample, everything went fine.  Then it was just a matter of cleaning up the Obsoleted warnings (which is a good idea, because apparently GetEnumerator from some MSMQ class is buggy).

Overriding Deserialized is simple.  Here's a sample that illistrates the concept (Event is the actual event you need to rehook).

override ISerializationNotification.Deserialized() {
      base.Deserialzed();

      if ( MyChild != null ) {
           MyChild.Event += new EventHandler( MyChild_Event );
      }
}

Copyright (c) Marimer LLC