{"id":816,"date":"2006-08-19T14:50:43","date_gmt":"2006-08-19T14:50:43","guid":{"rendered":"http:\/\/software.sil.org\/wesay\/?p=816"},"modified":"2024-08-02T18:12:22","modified_gmt":"2024-08-02T18:12:22","slug":"this-isnt-prototype-anymore","status":"publish","type":"post","link":"https:\/\/software.sil.org\/wesay\/this-isnt-prototype-anymore\/","title":{"rendered":"This Isn\u2019t Prototype Anymore"},"content":{"rendered":"<p>Thanks to Cathy, we now have a revamped skin on our wiki. We also have acquired so update your bookmarks.<\/p>\n<p>I have been working on two areas of WeSay. The first is our data access layer. <a href=\"https:\/\/dbdb.io\/db\/db4o\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">Db4o<\/a> provides a read only IList when queried. In the prototype, I had wrapped that result and provided our own read-write <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/5y536ey6.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">IList<\/a> that automatically kept the database up to date. With John\u2019s databinding work, we decided to provide a <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/system.componentmodel.ibindinglist.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">IBindingList<\/a> interface over db4o. I spent quite a bit of work creating tests for the various interfaces: <a href=\"https:\/\/github.com\/sillsdev\/wesay\/blob\/develop\/src\/WeSay.Data.Tests\/IBindingListBaseTest.cs\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">IBindingList tests<\/a>, <a href=\"https:\/\/github.com\/sillsdev\/wesay\/blob\/develop\/src\/WeSay.Data.Tests\/IListBaseTest.cs\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">IList tests<\/a>, <a href=\"https:\/\/github.com\/sillsdev\/wesay\/blob\/develop\/src\/WeSay.Data.Tests\/ICollectionBaseTest.cs\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">ICollection tests<\/a>, <a href=\"https:\/\/github.com\/sillsdev\/wesay\/blob\/develop\/src\/WeSay.Data.Tests\/IEnumerableBaseTest.cs\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">IEnumerable tests<\/a>. I had an implementation working with tests when we hit performance issues with filters and John found Marek Istvanek\u2019s work on providing a binding list over db4o. I chose to only use his db4oList class and implemented my own Db4oBindingList since we won\u2019t be needing the paging and didn\u2019t want to take on the associated risk. I had to modify the Db4oList class so that it would pass my previous tests.<\/p>\n<p>Another big change to the Db4oList class had to do with unregistering the PropertyChanged event on classes which implement <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/system.componentmodel.inotifypropertychanged.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">INotifyPropertyChanged<\/a>. A number of people have blogged about the \u201c<a href=\"http:\/\/weblogs.asp.net\/fmarguerie\/archive\/2004\/07\/27\/198489.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">lapsed listener<\/a>\u201d problem which causes objects to remain in memory due to the event source retaining a reference to the listener after the listeners go out of scope.<\/p>\n<p>The solution to this tricky issue is to either use weak delegates or require a call to dispose before the listener goes out of scope. <a href=\"http:\/\/wesnerm.blogs.com\/net_undocumented\/2005\/03\/clr_dinner.html\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">Wesner Moise<\/a> claims that implementing weak delegates is a difficult proposition with a number of casualties (<a href=\"http:\/\/www.bluebytesoftware.com\/blog\/PermaLink,guid,0d89ec27-a914-4e06-8eac-8cb8d5879566.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">Joe Duffy<\/a> and <a href=\"http:\/\/www.interact-sw.co.uk\/iangblog\/2004\/06\/06\/weakeventhandler\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">Ian Griffiths<\/a>) to date. I found three implementations that still purport to be correct: <a href=\"http:\/\/blogs.msdn.com\/greg_schechter\/archive\/2004\/05\/27\/143605.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">Greg Schechter<\/a> (he also provides the best overview of the problem space), <a href=\"http:\/\/www.seedindustries.com\/blog\/x\/2004_06_01_archive.html\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">Xavier Musy<\/a>, and <a href=\"https:\/\/www.codeproject.com\/Articles\/11737\/An-Easy-to-Use-Weak-Referenced-Event-Handler-Facto\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">John Stewien<\/a>. We finally decided the best way to handle this was to remove the listener from the event source when dispose is called.<\/p>\n<p>The other area is in moving our proof of concept lazy GTK nodestore to production standards. In the process I came across <a href=\"http:\/\/pvanhoof.be\/blog\/index.php\/2006\/04\/21\/databinding-an-ilist-as-datasource-for-the-gtktreeview\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">this blog entitled DataBinding an IList as DataSource for the Gtk.TreeView<\/a>. This obviously piqued my interest. At first, I adapted his code to use an <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/system.collections.ilist.aspx\" title=\"\" class=\"external\" target=\"_blank\" rel=\"noopener\">IList<\/a> but when I tried to load the assembly, I discovered that templated classes cannot contain references to external methods, which makes sense so I\u2019m back to using an IList. This is still a work in progress for me too, but you can check out what I\u2019ve done in our subversion repository.<\/p>\n<div class=\"top border\"><a href=\"#top\">top<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Thanks to Cathy, we now have a revamped skin on our wiki. We also have acquired so update your bookmarks. I have been working on two areas of WeSay. The first is our data access layer. Db4o provides a read only IList when queried. In the prototype, I had wrapped that result and provided our [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[18,19],"tags":[],"class_list":["post-816","post","type-post","status-publish","format-standard","hentry","category-db4o","category-gtk"],"acf":[],"_links":{"self":[{"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/posts\/816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":7,"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/posts\/816\/revisions"}],"predecessor-version":[{"id":1073,"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/posts\/816\/revisions\/1073"}],"wp:attachment":[{"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/categories?post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/software.sil.org\/wesay\/wp-json\/wp\/v2\/tags?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}