New Csla.Core.BusinessBase event clarificationNew Csla.Core.BusinessBase event clarification
Old forum URL: forums.lhotka.net/forums/t/5742.aspx
vdhant posted on Wednesday, November 05, 2008
Hi guys
I have just looking in Csla.Core.BusinessBase and I am wondering what is the difference between the following 2 methods (see below). I know that unhandled_UnhandledAsyncException get hooked up to the UnhandledAsyncException event via OnAddEventHooksInternal and OnRemoveEventHooksInternal (note this is the only reference to unhandled_UnhandledAsyncException in the code base). But Child_UnhandledAsyncException doesn't get called by anything - the only reference in the whole code base to Child_UnhandledAsyncException is in the method signature.
To me it seems like these are suppose to be the same method and the current Child_UnhandledAsyncException should be removed and the current unhandled_UnhandledAsyncException refactored to be Child_UnhandledAsyncException.
Here is the code in question:
void Child_UnhandledAsyncException(object sender, ErrorEventArgs e)
{
OnUnhandledAsyncException(e);
}
void unhandled_UnhandledAsyncException(object sender, ErrorEventArgs e)
{
OnUnhandledAsyncException(e);
}
Note if this is an issue then the same problem exists for busy_BusyChanged and Child_BusyChanged.
Cheers
Anthony
RockfordLhotka replied on Wednesday, November 05, 2008
I'll take a look at this, thanks!vdhant replied on Wednesday, November 05, 2008
Cheers
vdhant replied on Thursday, November 06, 2008
I think that I might have found another posible issue. The LoadManager property between BusinessBase and ReadOnlyBase is different.
BusinessBase:
internal AsyncLoadManager LoadManager
{
get
{
if (_loadManager == null)
{
_loadManager = new AsyncLoadManager();
_loadManager.BusyChanged += new BusyChangedEventHandler(loadManager_BusyChanged);
}
return _loadManager;
}
}
ReadOnlyBase:
internal AsyncLoadManager LoadManager
{
get
{
if (_loadManager == null)
{
_loadManager = new AsyncLoadManager();
_loadManager.BusyChanged += new BusyChangedEventHandler(loadManager_BusyChanged);
_loadManager.UnhandledAsyncException += new EventHandler<ErrorEventArgs>(loadManager_UnhandledAsyncException);
}
return _loadManager;
}
}
To me the ReadOnlyBase version seems more correct, but there may be a reason why you have done it this way.
Cheers
Anthony
RockfordLhotka replied on Thursday, November 06, 2008
Thanks, I’ll add this to the list too.
Rocky
Copyright (c) Marimer LLC