Closed GoogleCodeExporter closed 9 years ago
Original comment by bniemyjski
on 26 Mar 2010 at 12:12
Blake,
Its a codesmith template issue. The save methodology in the DataPortal_Update
method
isn't CSLA compliant. Easy fix.
Protected Overrides Sub DataPortal_Update()
Dim cancel As Boolean = False
OnUpdating(cancel)
If (cancel) Then
Return
End If
RaiseListChangedEvents = False
' Current template code
'For Each item As Consultant In Items
' item.Save()
'Next
' Suggested template code.
For myLoop As Integer = 0 To Me.Items.Count - 1
Me.Items.Item(myLoop) = Me.Items.Item(myLoop).Save()
Next
RaiseListChangedEvents = True
OnUpdated()
End Sub
Original comment by JenasysD...@gmail.com
on 26 Mar 2010 at 9:08
Attached Is the updated template that resolves the issue for VB.net.
Original comment by JenasysD...@gmail.com
on 28 Mar 2010 at 11:41
Attachments:
Blake,
I've run an nunit test over the code, with the following results. Note, the code
would save the record to the database, but wouldn't correctly populate PK
Identity
properties in you Business object after the save, which isn't optimal.
' CSLA 3.8.2 Failed to raise results back to the object.
'For Each item As Consultant In Items
' item = item.Save()
'Next
' The following code however does work as expected
For myloop As Integer = 0 To Items.Count - 1
Items.Item(myloop) = Items.Item(myloop).Save()
Next
I've attached a VB fix to the templates. I think you might also want to review,
(DataPortalUpdate*.cst for "item = item.Save()"), code to ensure that it's
correctly
executing (I have my doubts) based on my unit tests.
Original comment by JenasysD...@gmail.com
on 29 Mar 2010 at 1:46
Attachments:
Original comment by bniemyjski
on 15 Apr 2010 at 2:35
Original comment by bniemyjski
on 21 Jun 2010 at 8:10
Original issue reported on code.google.com by
JenasysD...@gmail.com
on 26 Mar 2010 at 7:14