It is done in the R731. http://code.google.com/p/unhaddins/source/detail?r=731 <http://code.google.com/p/unhaddins/source/detail?r=731> 2009/8/25 José Romaniello <[email protected]>
> I will make the change to return and index in the removed event of > the observableset . > For the other hand, somewhere fluent nh has to give you some access to the > nhibernate configuration. > > 2009/8/25 Chris Willard <[email protected]> > > >> Yeah, it is pretty strange. It seems to work fine with the Happy >> Nomad implementation of ObservableSet I mentioned at the beginning of >> my post so I guess I can just stick with that for now. I just wish I >> could figure out a way to configure it globally via Fluent. Thank you >> both for all your help and advice. >> >> Chris >> >> On Aug 25, 6:35 am, José Romaniello <[email protected]> wrote: >> > Chris , this could be a problem of the calling code (maybe wpf), since >> > withing a Set we haven't a index for items.. And the event handler of >> > "CollectionChanged" want the index of the item that was remove. You >> could >> > see the test here:http://digg.com/u1BO0j( >> > removeall_should_raise_collectionchanged_for_removeditems). >> > >> > I don't know how to set with fluent nhibernate the collection type >> factory. >> > >> > For the other hand, 100% AGREE with Fabio. >> > For instance the class that Fabio show to you, in "runtime", implements >> > INotifyPropertyChanged and IDataErrorInfo. >> > There is also another behavior for IEditableObject, actually there are >> > two. You could see how I configure the entityhttp://digg.com/u1BO11 >> > >> > 2009/8/25 Fabio Maulo <[email protected]> >> > >> > > what I mean is that you can do the same without that boiled code. >> > >> > > 2009/8/25 Chris Willard <[email protected]> >> > >> > >> Those interfaces are implemented in my entity base class >> > >> (BindableObject) from which GuidPOCO is derived (Section > GuidPOCO > >> > >> BindableObject). I am not familiar with the term boiled code, so I >> am >> > >> not sure how to respond. Please let me know if you need any >> > >> additional info or if I am misunderstanding something. >> > >> > >> This is how my base class is defined: >> > >> > >> public abstract class BindableObject : INotifyPropertyChanged, >> > >> IEditableObject, IDataErrorInfo >> > >> > >> Thanks in advance, >> > >> Chris >> > >> > >> On Aug 24, 10:53 pm, Fabio Maulo <[email protected]> wrote: >> > >> > Classes in this domainhttp:// >> > >> code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAd... >> > >> > < >> > >>http://code.google.com/p/unhaddins/source/browse/trunk/Examples/uNHAd >> .. >> > >> .>are >> > >> > implementing INotifyPropertyChanged, IEditableObject, >> IDataErrorInfo... >> > >> > but... where is the boiled code ? >> > >> > >> > how that entities can work in this video ? (see bottom) >> > >> >> http://jfromaniello.blogspot.com/2009/08/nhibernate-and-wpf-viewmodel... >> > >> > >> > 2009/8/25 Chris Willard <[email protected]> >> > >> > >> > > Yeah, I was thinking he wanted to see the entire entity for some >> > >> > > reason... >> > >> > >> > > On Aug 24, 10:06 pm, Fabio Maulo <[email protected]> wrote: >> > >> > > > too much boiled code. >> > >> > >> > > > 2009/8/24 Chris Willard <[email protected]> >> > >> > >> > > > > Oh yeah, sorry. I am calling this extension method to remove >> the >> > >> > > > > item: >> > >> > >> > > > > public static void RemoveRange<T>(this ICollection<T> >> > >> > > > > collection, IEnumerable<T> items) >> > >> > > > > { >> > >> > > > > if (items != null) >> > >> > > > > { >> > >> > > > > foreach (var item in items) >> > >> > > > > { >> > >> > > > > collection.Remove(item); >> > >> > > > > } >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > And this is the entity: >> > >> > >> > > > > using System; >> > >> > > > > using System.Collections.Generic; >> > >> > > > > using System.Linq; >> > >> > > > > using System.Text; >> > >> > > > > using RGI.Utilities; >> > >> > > > > using RGI.Utilities.Validators; >> > >> > > > > using uNhAddIns.WPF.Collections; >> > >> > >> > > > > namespace RGI.BMS.POCO >> > >> > > > > { >> > >> > > > > [Serializable] >> > >> > > > > public class Section : GuidPOCO >> > >> > > > > { >> > >> > > > > #region Constructors >> > >> > >> > > > > public Section() : base() >> > >> > > > > { >> > >> > > > > this.SectionNumbers = new >> > >> ObservableSet<SectionNumber>(); >> > >> > > > > } >> > >> > >> > > > > #endregion >> > >> > >> > > > > #region Fields >> > >> > >> > > > > private string _Name; >> > >> > > > > private Employee _ModifiedBy; >> > >> > > > > private DateTime _ModifiedDate; >> > >> > > > > private ICollection<SectionNumber> _SectionNumbers; >> > >> > >> > > > > #endregion >> > >> > >> > > > > #region Properties >> > >> > >> > > > > public virtual string Name >> > >> > > > > { >> > >> > > > > get { return _Name; } >> > >> > > > > set >> > >> > > > > { >> > >> > > > > _Name = value; >> > >> > > > > NotifyPropertyChanged("Name"); >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > public virtual Employee ModifiedBy >> > >> > > > > { >> > >> > > > > get { return _ModifiedBy; } >> > >> > > > > set >> > >> > > > > { >> > >> > > > > _ModifiedBy = value; >> > >> > > > > NotifyPropertyChanged("ModifiedBy"); >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > public virtual DateTime ModifiedDate >> > >> > > > > { >> > >> > > > > get { return _ModifiedDate; } >> > >> > > > > set >> > >> > > > > { >> > >> > > > > _ModifiedDate = value; >> > >> > > > > NotifyPropertyChanged("ModifiedDate"); >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > public virtual ICollection<SectionNumber> >> SectionNumbers >> > >> > > > > { >> > >> > > > > get { return _SectionNumbers; } >> > >> > > > > set >> > >> > > > > { >> > >> > > > > _SectionNumbers = value; >> > >> > > > > NotifyPropertyChanged("SectionNumbers"); >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > #endregion >> > >> > >> > > > > #region Methods >> > >> > >> > > > > public override int GetHashCode() >> > >> > > > > { >> > >> > > > > System.Text.StringBuilder sb = new >> > >> > > > > System.Text.StringBuilder(); >> > >> > >> > > > > sb.Append(this.GetType().FullName); >> > >> > > > > sb.Append(Id); >> > >> > > > > sb.Append(_ModifiedBy); >> > >> > > > > sb.Append(_ModifiedDate); >> > >> > > > > sb.Append(_Name); >> > >> > >> > > > > return sb.ToString().GetHashCode(); >> > >> > > > > } >> > >> > >> > > > > #endregion >> > >> > >> > > > > #region Readonly Properties >> > >> > >> > > > > public virtual string NumberDisplay >> > >> > > > > { >> > >> > > > > get >> > >> > > > > { >> > >> > > > > StringBuilder bld = new StringBuilder(); >> > >> > >> > > > > //Get sorted list >> > >> > > > > var numbers = this.SectionNumbers.OrderBy(o => >> > >> > > > > o.Number); >> > >> > >> > > > > foreach (var item in numbers) >> > >> > > > > { >> > >> > > > > bld.Append(item.Number); >> > >> > > > > if (!numbers.Last().Equals(item)) >> > >> > > > > bld.Append(", "); >> > >> > > > > } >> > >> > >> > > > > return bld.ToString(); >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > #endregion >> > >> > >> > > > > #region Validation >> > >> > >> > > > > public override string this[string columnName] >> > >> > > > > { >> > >> > > > > get { return CheckValidation(this, columnName); } >> > >> > > > > } >> > >> > >> > > > > #endregion >> > >> > > > > } >> > >> > > > > } >> > >> > >> > > > > Thanks again for all the help, >> > >> > > > > Chris >> > >> > >> > > > > On Aug 24, 6:54 pm, José Romaniello <[email protected]> >> > >> wrote: >> > >> > > > > > Sorry, I want to see the property where you need to put the >> > >> > > > > observableset. >> > >> > > > > > And the code that you are using to remove an item from that >> > >> > > collection. >> > >> > >> > > > > > 2009/8/24 Chris Willard <[email protected]> >> > >> > >> > > > > > > Below is my base entity class. I have a class (GuidPOCO) >> that >> > >> > > > > > > inherits from BindableObject and just implements an Id >> > >> property as >> > >> > > a >> > >> > > > > > > guid along with some vaidation logic. >> > >> > >> > > > > > > /// <summary> >> > >> > > > > > > /// Implements the INotifyPropertyChanged interface >> and >> > >> > > > > > > /// exposes a NotifyPropertyChanged method for derived >> > >> > > > > > > /// classes to raise the PropertyChange event. The >> event >> > >> > > > > > > /// arguments created by this class are cached to >> prevent >> > >> > > > > > > /// managed heap fragmentation. >> > >> > > > > > > /// </summary> >> > >> > > > > > > [Serializable] >> > >> > > > > > > public abstract class BindableObject : >> > >> INotifyPropertyChanged, >> > >> > > > > > > IEditableObject, IDataErrorInfo >> > >> > > > > > > { >> > >> > > > > > > #region Data >> > >> > >> > > > > > > private static readonly Dictionary<string, >> > >> > > > > > > PropertyChangedEventArgs> eventArgCache; >> > >> > > > > > > private const string ERROR_MSG = "{0} is not a >> public >> > >> > > property >> > >> > > > > > > of {1}"; >> > >> > > > > > > private static readonly object syncLock = new >> object(); >> > >> > > > > > > private HybridDictionary oldState; >> > >> > >> > > > > > > #endregion // Data >> > >> > >> > > > > > > #region Constructors >> > >> > >> > > > > > > static BindableObject() >> > >> > > > > > > { >> > >> > > > > > > eventArgCache = new Dictionary<string, >> > >> > > > > > > PropertyChangedEventArgs>(); >> > >> > > > > > > } >> > >> > >> > > > > > > protected BindableObject() >> > >> > > > > > > { >> > >> > >> > > > > > > } >> > >> > >> > > > > > > #endregion // Constructors >> > >> > >> > > > > > > #region Public Members >> > >> > >> > > > > > > /// <summary> >> > >> > > > > > > /// Raised when a public property of this object >> is >> > >> set. >> > >> > > > > > > /// </summary> >> > >> > > > > > > [field: NonSerialized] >> > >> > > > > > > public virtual event PropertyChangedEventHandler >> > >> > > > > > > PropertyChanged; >> > >> > >> > > > > > > /// <summary> >> > >> > > > > > > /// Returns an instance of >> PropertyChangedEventArgs for >> > >> > > > > > > /// the specified property name. >> > >> > > > > > > /// </summary> >> > >> > > > > > > /// <param name="propertyName"> >> > >> > > > > > > /// The name of the property to create event args >> for. >> > >> > > > > > > /// </param> >> > >> > > > > > > public >> > >> > ... >> > >> > read more » >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
