[Mono-devel-list] [PATCH] Correct some events thrown by DataView

Marc Haisenko haisenko at webport.de
Wed Jul 20 11:14:02 EDT 2005


Hi folks,
the next patch. This one is about the events thrown by DataView.

Problem currently is that DataView throws an event too often or when it 
shouldn't be thrown. This caused major problems in a huge .NET project for 
which I fix bugs in DotGNU/Mono.

Now when you run the attached test application with Monos System.Data 
namespace you'll see a lot of ListChanged events with ListChangedType.Reset 
where no such event should be thrown (adding a row, changing an item, 
deleting a row). This is because the (Mono internal) method 
DataView.UpdateIndex always throws this event, and UpdateIndex is called a 
lot.

The attached patched removes this event from UpdateIndex and throws it 
manually where needed (set_Sort, set_Table). It also corrects one incorrect 
throwing of the ListChanged event in Reset () (where the event was thrown 
twice, BTW, since Reset calls Open which in turn calls UpdateIndex).

I've also attached a little test application which writes what it does and the 
events thrown (plus their arguments) into a file. Of course it's no complete 
unit test but catches the most important cases, I think. Also included in the 
directory with the executable is a sample output from MS.NET. To compare the 
output from MS.NET with the one produced by Mono you have to do "diff -uw 
TableTest.log.MS TableTest.log" to ignore the different line endings.

I've also noted that in some cases the order in which events are thrown are 
switched, it's always:
MS: DataView.ListChanged then DataTable.RowChanged
Mono: DataTable.RowChanged then DataView.ListChanged

Not sure whether this should be fixed as well but I think the most important 
thing is that the same events are thrown (in the same amount ;-), not the 
order...

C'ya,
	Marc
-- 
Marc Haisenko
Systemspezialist
Webport IT-Services GmbH
mailto: haisenko at webport.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DataView.cs.Events.patch
Type: text/x-diff
Size: 1278 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050720/8523124b/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TableTest.zip
Type: application/x-zip
Size: 11637 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050720/8523124b/attachment-0001.bin 


More information about the Mono-devel-list mailing list