tag:blogger.com,1999:blog-5673710449979080453.post2775538672425794630..comments2023-06-04T04:43:23.586-04:00Comments on Happy Nomad: Collections for WPF and NHibernateAdrian Alexander Pinterhttp://www.blogger.com/profile/03189159591463976343noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-5673710449979080453.post-61225752890682403042010-10-19T11:34:27.011-04:002010-10-19T11:34:27.011-04:00Thanks HappyNomad for the collections, and Mahara ...Thanks HappyNomad for the collections, and Mahara for fixing the Add bug (needing to pass the index of the newly created item, this fixed my app randomly crashing on 2nd item being added!)Michal Ciechanhttps://www.blogger.com/profile/17285404260692522969noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-35473386437987375502009-07-31T02:37:13.739-04:002009-07-31T02:37:13.739-04:00Ah, I just knew if WPF is smart enough adding the ...Ah, I just knew if WPF is smart enough adding the indexes.<br /><br />The problematic behavior I encountered was happening when using the Xceed WPF DataGridControl (version 3.2). Actually, it worked just fine using the previous version (3.1) which makes me confused.<br />And yes, I'm not using standard WPF controls as you mentioned before.<br /><br />Perhaps, it is a bug within the DataGridControl itself, but the workaround I proposed works for me so far.maharahttps://www.blogger.com/profile/11814426241400075070noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-15994001881763079312009-07-31T02:04:06.386-04:002009-07-31T02:04:06.386-04:00I'm glad you got your app working, Mahara. I ...I'm glad you got your app working, Mahara. I hadn't put that code in since, in my various tests, adding items to sets didn't pose any problems. For add operations at least, WPF seems smart enough to append to the end of its list (i.e. ListView.Items, TreeView.Items, TreeViewItem.Items) if no explicit index is supplied. So I'm not sure the circumstances under which your problem arose.Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-60107748307820895082009-06-21T06:10:27.652-04:002009-06-21T06:10:27.652-04:00Overall, after I compared the MS ObservableCollect...Overall, after I compared the MS ObservableCollection`1 and your ObservableSet`1 implementations, I saw a small difference in the Add logic. It seems that WPF also requires that the added item index to be included in the collection changed notification.<br /><br />So, I changed your current implementation of ObservableSet`1.Add() method from this:<br /><br />[code]<br /> OnCollectionChanged( NotifyCollectionChangedAction.Add, item );<br />[/code]<br /><br />to this:<br /><br />[code]<br /> int index = this.IndexOf(item);<br /> if (CollectionChanged != null)<br /> CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, (object) item, index));<br />[/code]<br /><br />And finally, the problem I encountered disappeared completely.maharahttps://www.blogger.com/profile/11814426241400075070noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-43376381699111634312009-06-20T20:47:28.217-04:002009-06-20T20:47:28.217-04:00Hello Mahara, thanks for your feedback. Unfortuna...Hello Mahara, thanks for your feedback. Unfortunately, I don't have time now to test out this latest NH release myself. Please investigate the matter and let me know.Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-25080821328962621882009-06-20T14:19:39.851-04:002009-06-20T14:19:39.851-04:00I just recently tried using it on NHibernate 2.1 B...I just recently tried using it on NHibernate 2.1 Beta 1, but it seems there's a problem with adding item into the ObservableSet`1. I'm using it in WPF.<br /><br />Thanks for this!maharahttps://www.blogger.com/profile/11814426241400075070noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-82648547827620506422008-12-09T17:30:00.000-05:002008-12-09T17:30:00.000-05:00I've upgraded the solution to reference NH 2.1 (th...I've upgraded the solution to reference NH 2.1 (the current trunk). Because of changes made to NH's persistent-collection base classes, I needed to take a new approach for intercepting collection-change events. Over on the nhibernate-development Google Group, Andrew Cullen provided a nice alternative. I haven't tested with previous NH versions, although I think it'll work.Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-79540449048574855672008-12-01T13:23:00.000-05:002008-12-01T13:23:00.000-05:00Answered my own question, after reading your last ...Answered my own question, after reading your last comment. Backed out the 'int anticipatedSize' parameters, compiled against NHibernate 1.2 references, and all is well.<BR/><BR/>Thanks again for the library!<BR/><BR/>David Veeneman<BR/>Foresight SystemsDavid Veenemanhttps://www.blogger.com/profile/12668142467702342590noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-62449154780943406082008-12-01T12:23:00.000-05:002008-12-01T12:23:00.000-05:00Thanks for the library! I'm just getting started o...Thanks for the library! I'm just getting started on WPF, and it looks like just what I need.<BR/><BR/>Does the current version of the library work with NHibernate 1.2? I assume it doesn't, since it is built against NHibernate 2.0 references. If that's the case, is there a way to get the NHibernate 1.2 version of the library? Thanks again.<BR/><BR/>David Veeneman<BR/>Foresight SystemsDavid Veenemanhttps://www.blogger.com/profile/12668142467702342590noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-39550172516968613162008-11-17T02:16:00.000-05:002008-11-17T02:16:00.000-05:00I finally installed NH 2.0... sorry for the delay....I finally installed NH 2.0... sorry for the delay. I already got my library/demo working. It was incredibly simple! In the ObservableBagType, ObservableListType, and ObservableSetType classes I just had to change the signature of 'object Instantiate()' to 'object Instantiate(int anticipatedSize)'. You guys had me worried it was going to be something big.. jajaja.Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-50275158673287340272008-09-22T09:46:00.000-04:002008-09-22T09:46:00.000-04:00Hi, now NH is 2.0 stable version... u have a possi...Hi, now NH is 2.0 stable version... u have a possiblity to update ur code? :D<BR/><BR/>ps.<BR/><BR/>sorry 4 bad englishWaYdotNEThttps://www.blogger.com/profile/07255007741936763184noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-57948354345829047402008-09-08T02:04:00.000-04:002008-09-08T02:04:00.000-04:00Do you can create a wiki reference about your coll...Do you can create a wiki reference about your collections work and how use it in the users-wiki of NHForge ?<BR/>http://www.nhforge.org/groups/nhusers/wiki/default.aspx<BR/><BR/>To create it is enough sign in.<BR/>If you don't know NHForge it is the NHibernate community site.<BR/>You are welcome.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-16768434928519484332008-07-31T15:37:00.000-04:002008-07-31T15:37:00.000-04:00Hi master !Man, NHibernate now is RC1, and in news...Hi master !<BR/><BR/>Man, NHibernate now is RC1, and in newsgroup they say no changes will come for official release.Unknownhttps://www.blogger.com/profile/08278479058065921282noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-45682830994455285322008-07-24T03:21:00.000-04:002008-07-24T03:21:00.000-04:00"just a NHibernate user" is how we all start out, ..."just a NHibernate user" is how we all start out, and probably wish to remain, but it often doesn't work out that way (didn't for me). I don't plan to use NHibernate 2.0 until after it's out of beta, so don't expect any 2.0-related updates from me before then (I do, however, upload other improvements every now and then). I encourage you to start digging into NH's guts (it's addictive, trust me), then you may be able to fix some of those problems yourself (let me know if you do).Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-85988368125685180472008-07-24T02:54:00.000-04:002008-07-24T02:54:00.000-04:00Tanx for your effort. I tried to use this with NHi...Tanx for your effort. I tried to use this with NHibernate 2.0 beta2 and there seems to be some uppgrades which breakes your code. Are you planning to make some updates. ( Sorry to say, I'm not so skilled on NHibenate that I "dare" to fix the problems.. I'm just a NHibernate user, with problems of my own :)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-63550307425827335382008-01-23T23:21:00.000-05:002008-01-23T23:21:00.000-05:00Using my collections in the absence of WPF hadn't ...Using my collections in the absence of WPF hadn't even occurred to me. Thinking about it now, though, nearly every NHibernate project has bidirectional associations, which might be your reason. You shouldn't have any problem doing so. My "Example" project is in WPF, but the "Library" project doesn't reference any WPF assembly. Just copy the code files from there into your solution, then you can start with your observable fun.Adrian Alexander Pinterhttps://www.blogger.com/profile/03189159591463976343noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-22478450475253220862008-01-23T02:53:00.000-05:002008-01-23T02:53:00.000-05:00I am interesting in integrating your ObservableCol...I am interesting in integrating your ObservableCollections into a VS2005 WinForm project.<BR/><BR/>Since I cannot open your WPF example, will it be possible for you to describe the steps required to integrate your classes into a WinForm project?<BR/><BR/>Thanks for sharing!Nadavhttps://www.blogger.com/profile/08358921919811418478noreply@blogger.comtag:blogger.com,1999:blog-5673710449979080453.post-50886298933222473502007-12-12T05:39:00.000-05:002007-12-12T05:39:00.000-05:00Really thanks for your good job !Really thanks for your good job !Unknownhttps://www.blogger.com/profile/08278479058065921282noreply@blogger.com