开发者

Observable List Nhibernate

I'm attempting to have wpf databind to a collection of data models and, display them using datatemplates. Currently this is working perfectly when using an IList, however the databinding doesn't seem to pick up adds/removes on the IList. I'm assuming this is related to nhibernate's collections not being observable. I tried to implement Nomad's WPF Collections without much luck (nH says it's not implementing UserCollectionType)

I'm not particularly keen on figuring out how to fix nomad's collections so I'm wondering if there's a better way of achieving an observable collection for wpf-nhibernate binding, especially now with the release of nH 3.0

Thanks in advance!开发者_JAVA百科


Take a look at unhaddins.You can find implementations of Observables Nhibernate`s collections


More simple way is to use property setter for observable collection initialization:

private ObservableCollection<ItemType> _items = new ObservableCollection<DynamicActivity>();
    public IList<DynamicActivity> Items
    {
        get { return _items; }
        set { _items = new ObservableCollection<ItemType>(value); }
    }

Just need to define appropriate mapping strategy - use only access = "property".


If your collection implements IList then you are able to map it as a usual bag collection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜