events not firing after change to WCF

events not firing after change to WCF

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


nj609eagle posted on Friday, February 13, 2009

After getting most of the business logic working in my first CSLA application, I made the changed to WCF Data Portal.  After much tweaking of the configuration values to get the objects to send and receive.  I realized that I forgot to add some Validation Rules.  These rules are basic StringRequired rules. When I went to test everything I noticed two problems.

1.      The rules do not appear to be broken when the data is retrieved.  Obviously the data should never be saved with these errors, but it’s an old application and the data is what it is and would require the users to fix going forward.

2.      My events no longer bubble up the parent-child chain.

Any help would be greatly apppreciated.  Page Number in C# 2008 book?

All of my classes have:
    Private Sub New()
        MyBase.New()
        _forceInit = 0
        MarkAsChild() <--Not in the Root Application (BB) class
    End Sub

Additionally they all have:
    Protected Overloads Overrides Sub OnDeserialized( _

ByVal context As System.Runtime.Serialization.StreamingContext)

        _forceInit = 0

        MyBase.OnDeserialized(context)
    End Sub

I added to all of the BLB (but these never fire):
    Protected Overloads Sub OnDeserialized( _

ByVal context As System.Runtime.Serialization.StreamingContext)

        _forceInit = 0

        MyBase.OnDeserialized()
    End Sub



Application BB
                Section3 BB
                                Section3_2 BB
                                               
CommitteePersonSalaryList BLB
                                                                CommitteePersonSalary BB

CommitteePersonSalary responds to the PropertyChanged Event to set other values of the object.

Section3_2 responds to ChildChanged to set values of its self based on summary totals of CommitteePersonSalary.

Section3_2 Property Declaration
Private
Shared CommitteePersonSalaryProperty As PropertyInfo(Of CommitteePersonSalaryList) = RegisterProperty(Of CommitteePersonSalaryList)(New PropertyInfo(Of CommitteePersonSalaryList)("CommitteePersonSalary"))

Public ReadOnly Property CommitteePersonSalary() As CommitteePersonSalaryList

Get
   If
Not FieldManager.FieldExists(CommitteePersonSalaryProperty) Then
         
LoadProperty(Of CommitteePersonSalaryList)(CommitteePersonSalaryProperty, 
         CommitteePersonSalaryList.GetCommitteePersonSalaryByApplicationID(Me.ApplicationID))
End If
   Return
GetProperty(Of CommitteePersonSalaryList)(CommitteePersonSalaryProperty)
End Get
End
Property

 

ajj3085 replied on Friday, February 13, 2009

For 1. are you calling ValidationRules.CheckRules before you exit your DataPortal_Fetch?

For 2., are you using managed child properties?  Also, child property changes are bubbling up anymore, by design.  Did you recently upgrade your Csla version?  What version are you using now?  3.6.1 doesn't require _forceInit any longer.

nj609eagle replied on Friday, February 13, 2009

I'm using version 3.6.1.

did you mean Also, child property changes are not bubbling up anymore, by design.

If so, why does it work when the object its not serilized using WCF and going directly?

 

ajj3085 replied on Friday, February 13, 2009

Well it sounds like the event hookups are being lost in serialization.  Are you child objects managed?

nj609eagle replied on Friday, February 13, 2009

Yes.  You can see from the code above how they are being declared and loaded

I added the _forceInit before changing from 3.6.0 to 3.6.1

Copyright (c) Marimer LLC