isDirty in BusinessListBase

isDirty in BusinessListBase

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


ballistic posted on Monday, August 13, 2007

Have a class which lists tags for a member:

Public Class MemberTagList
     Inherits BusinessListBase(Of MemberTagList, MemberTag)

This class has a function (TextToList) which will parse a comma seperated string and for each "tag" add it to the list. This function ONLY gets called if the current Member's tags are different from what they entered.

The IsDirty property on the list is being set correctly when I have new item to add to the list.  However, if no items are set, I still need the list to be dirty. (For instance they had tags in their account, but are now removing them)

How can I force TextToList to set the IsDirty flag to true?

This is how I'm using it:

Set(ByVal TagListText As String)
     CanWriteProperty(
True)
    
If (BioTagsText <> TagListText) Then
          _BioTags = Tags.MemberTagList.TextToList(_Id, TagListText) 
         
PropertyHasChanged()
    
End If
End Set

Then in the update, I check to see if the list is dirty:

If (_BioTags.IsDirty) Then
   Tags.MemberTagList.UpdateToDB(_Id, _BioTags)
End If

juddaman replied on Friday, August 17, 2007

Hi

If you call MarkDirty() in the ctor of MemberTagList then new lists will always be dirty. So even if TextToList(x,y) returns a new empty list then IsDirty will return true. The ctor may not be the best place to call MarkDirty() but it should work for now as long as you are calling MarkOld() after your fetch and updates as you are probably already doing.

Regards

George

Copyright (c) Marimer LLC