StrataFrame Forum

BeforeSave event not firing in 1.6.6

http://forum.strataframe.net/Topic16020.aspx

By Randy Jean - 4/30/2008

I have some code in the beforesave event of one of my business objects. I've verified the handler is still connected. When I set a break point and fire a save on this business object, the code in event handler is not firing. Any ideas?
By Edhy Rijo - 4/30/2008

Hi Randy,

Make sure the Business Object property IncludeInFormSave is set to True for that BO.

In case that does not work, please provide more detail info like this:

  • What version of the SF Assemblies are you using?
  • How many BO are you using in this form?
  • Is the mentioned BO a Parent or a Child BO?
By Trent L. Taylor - 4/30/2008

Edhy's questions are valid, but it appears that the handler isn't attached or the BO is not being saved.  I just setup a test and it works as it should, so let's start digging through your environment.
By Randy Jean - 4/30/2008

IncludeInFormSave is true. This actually the main BO on an SF Wizard Form. In the Finish_Clicked i'm just calling me.save() - this BO is set as my PrimaryBusinessObject as well. It is the parent.



The handler is connected. In the properties I see the method is linked and when I double click it take me to that code which has Handles MyBase.BeforeSave.





Private Sub DCASetupDataBO_BeforeSave(ByVal e As MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs) Handles MyBase.BeforeSave

Dim nNumberOfSolutions As Integer = 0

If Me.SolutionLevel1 <> Guid.Empty Then

nNumberOfSolutions = nNumberOfSolutions + 1

End If

If Me.SolutionLevel2 <> Guid.Empty Then

nNumberOfSolutions = nNumberOfSolutions + 1

End If

If Me.SolutionLevel3 <> Guid.Empty Then

nNumberOfSolutions = nNumberOfSolutions + 1

End If

Me.NumberSolutions = nNumberOfSolutions

End Sub





Just updated to 1.6.6 - everything builds fine and this was working prior to the update so not sure what could be going on.



File versions are showing 1.6.5.1 on all assemblies in Strataframe version dialog.



Thanks,

Randy










By Randy Jean - 4/30/2008

I forgot to mention there are other BOs but they are not getting updated by the form so I set them all to be IncludeInFormSave = false



Still no go. I know the save is firing because my checkrulesoncurrentrow is firing which is telling me that my numberofsolutions is required. Hmm... maybe this event fires before the beforesave event now...
By Randy Jean - 4/30/2008

Yep, looks like that is what is happening. Checkrulesoncurrentrow in the bizobj is firing before any of the beforesave events, which sort of makes sense I suppose from a logical standpoint. Knowing this I think I can probably find a workaround. Not using beforesave in too many places.
By Trent L. Taylor - 4/30/2008

Use the BusinessRulesChecked event.  This will get fired every time and allow you to override any broken rules (if you have that need).  But it will always fire pre-save whether there are broken rules or not.
By Randy Jean - 4/30/2008

Thanks, I'll give this a try.