I am trying to use Fluent-Nibernate with wpf that require Observable collections (implement the INotifyCollectionChanged interface).
At uNHAddins: Unofficial addins for NHibernate i found the
uNhAddIns.WPF.Collections.Types.ObservableListType<T>
that implements INotifyCollectionChanged. It can be configured in Fluent-Nibernate like this
namespace FluentNHibernateTutorial.Mappings
{
public class StoreMap : ClassMap<Store>
{
public StoreMap()
{
Id(x => x.Id);
Map(x => x.Name);
HasManyToMany(x => x.Products)
.CollectionType<uNhAddIns.WPF.Collections.Types
.ObservableListType<Product>>()
.Cascade.All()
.Table("StoreProduct");
}
}
}
Does anybody know how to implement a Convention with Fluent-Nibernate that always uses ObservableListType as default IList implementation ?
Update: The perfect solution would be something that does the replacement with Fluent-NHibernate-Automapper
Something like this should do the trick:
In response to the question update:
This convention should work with the automapper like so: