This project is read-only.

SubDomain Reports Dirty - Incorrectly

Jun 15, 2011 at 11:31 PM
Edited Jun 15, 2011 at 11:44 PM

I am experiencing an issue that I cannot track down.

I have a winform that I close, but before closing it checks that the subdomain is not Dirty

I retrieve the data from the database (providing a userid as the modifier)

 

Public Sub New(Optional ByVal applicationID As Integer = -1)
        InitializeComponent()
        _data = ApplicationEvaluation.SelectUsingPK(applicationID, HelperObject.UserID)
        If _data Is Nothing Then
            Dim collection As New ApplicationEvaluationCollection(HelperObject.UserID)
            _data = collection.NewItem(-1)
            collection.AddItem(_data)
        ElseIf _data.ApplicationApprovalStatus = 1 Then 'Approved
            btnRating.Visible = True
        End If
        SetTitleText()
    End Sub

 

I make no changes to the table in question I close the form and the subdomain reports dirty

 

Dim toReturn as Boolean = False
With _data
          If .ParentCollection.SubDomain.IsDirty Then
               toReturn = True
          End If

....

 

It appears that the only column to change in the collection (Genders in this case) is the ModifiedBy field.  I found this out by placing a Breakpoint in SubDomain.cs/IsDirty when the return value is set to true.

Thanks,

 

Steve

Jun 16, 2011 at 3:57 PM

If I go ahead and let it persist the changes, the Genders ModifiedBy gets updated to my userID, but the ModifiedDate doesn't update to the current datetime.

Jun 16, 2011 at 5:25 PM

After even more digging;

It appears that the various DomainCollection OnRowChanged events fire when walking relationships.  I believe this is a bug.

.DataSource = (From t In _data.Applicationtenants_publichousingapplicationApplicationTenantsList
                            Where Not (t.IsApplicant Or t.IsCoApplicant)
                            Order By t.Applicationtenants_tenantsTenantsItem.Lastname
                            Select New With {t.TenantID,..., .Gender = t.Applicationtenants_tenantsTenantsItem.Tenants_gendersGendersItem.Description, .Relationship = t.Applicationtenants_relationshipsRelationshipsItem.Description}).ToList

Jun 28, 2011 at 12:08 AM

I might need a little more help. I have a Parent and Child table and I load a parent and walk to the child and check the subdomain's IsDirty property and it is still not set true. Could you create a small working sample that demonstrates this? I have traced through the code when walking and it does fire the RowChanged event because it did add a row but this does not set the dirty property. I cannot get the property set true simply by walking. A sample would be most helpful.

Jun 28, 2011 at 6:31 PM

I have attached a sample project to BUG 6844.  If you have questions please ask.

 

Thank-you.

 

Steve

Jun 30, 2011 at 6:36 PM

I put this in the Bug (6844) as well but in case this catches your attention first.

After a bunch of digging what I think is the issue.  In the sample I provided the code makes it into the "if" in the generated collection function "OnRowChanged" below, but when I inspect e.Row.RowState it claims the row is unchanged.

After only the couple of tests that I have set to test this issue it appears to function as expected when I made the change to the generated code.In my sample the file is DomainGendersCollectionGenerated.cs and the line in question is 174.
I have modifed that line to look like this 

if(e.Action == DataRowAction.Change && mModifyUpdateOn && e.Row.RowState != DataRowState.Unchanged)

it used to look like

if(e.Action == DataRowAction.Change && mModifyUpdateOn)

I suggest that you modify the appropriate line in the generator code file "DomainCollectionGeneratedTemplate" Line 638  and test.

The only thing that I can think that this might affect is the subdomain.Merge functionality, I cannot be certain.

Let me know if you still are having issues reproducing my issue here.

Thanks, Steve

Jul 1, 2011 at 8:17 PM

I know that this is an option but at this time I think it requires more investigation as this does not happen anywhere I can reproduce. Even translating your VB to C# does not cause the issue. Some thing is different about how your code calls or loads that I have figured out yet.

Jul 1, 2011 at 8:57 PM
Did you reproduce the bug by running my sample?



-- Sent from my Palm Pre


On Jul 1, 2011 1:16 p.m., codetools <notifications@codeplex.com> wrote:

From: codetools

I know that this is an option but at this time I think it requires more investigation as this does not happen anywhere I can reproduce. Even translating your VB to C# does not cause the issue. Some thing is different about how your code calls or loads that I have figured out yet.


--Alternative__boundary__1309550095296--
Jul 1, 2011 at 10:25 PM

Yes. I did reproduce this but only in the VB version. When I converted it to C# it did not occur and I do not know why. I have actually implemented your suggestion to address this issue and it will be in the next version.

Jul 4, 2011 at 3:48 PM

 

I noticed that lines 4 and 5 of your C# conversion stops the issue from occurring. I cannot tell you why. Commenting out these two lines makes the issue appear.

I just wanted to make sure that you noticed that. Thanks for jumping all over this issue, it's been driving me bonkers!

Steve