Subscribing to Event in Editible object from List

Subscribing to Event in Editible object from List

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


Joffies posted on Friday, April 25, 2008

I have been looking at sample  that Rocky gave to refresh for example a CustomerList when a Editble Customer object is updated without refreshing the whole customer list.

  1. I have declared my Event within my Editble object and the sub raising the event

    Public Event AdministratorSaved(ByVal sender As Administrator, ByVal e As Csla.Core.SavedEventArgs)

    Private Sub OnAdminstratorSaved(ByVal sender As Administrator, ByVal e As Csla.Core.SavedEventArgs)

    RaiseEvent AdministratorSaved(sender, e)

    End Sub

  2. I have modified my save factory method to call the method to raise the event

    Dim
    result As Administrator = MyBase.Save

    OnAdminstratorSaved(
    Me, New Csla.Core.SavedEventArgs(result))

    Return result

  3. Where and how on my AdministratorList object will i hook up to the the AdministratorSaved event specified on the Administrator object? Protected Overrides Sub Initialize() ?

 

 

ajj3085 replied on Friday, April 25, 2008

I think the solution is you need to have some common static class which declares the events, which your editable BO can also ask to raise the events.

Joffies replied on Monday, April 28, 2008

I would prefer to do it like Rocky's proposed solution in one of his samples excluded from his book.

http://www.lhotka.net/weblog/IAmWorkingOnMyUsingCSLANET30EbookAndWroteSomeContentThatIDontThinkImGoingToUseInTheBook.aspx

 

Copyright (c) Marimer LLC