Hi All,
I have a domain object that has been auto generated for me by MyGeneration. This is generated using an NHbernate template. This is part of the object - I have removed most of it,
[Serializable]
public class Purchase : INotifyPropertyChanged
{
protected int id;
public event PropertyChangedEventHandler PropertyChanged;
public virtual int Id
{
get { return id; }
set {if (value != this.id){id= value;NotifyPropertyChanged("Id");}}
}
}
When I try to save one of these objects into the database I get an exception
NHibernate.InvalidProxyTypeException: The following types may not be used as proxies: NHibernateDemo.DataLayer.Entities.Purchase: method add_PropertyChanged should be 'public/protected virtual'
Etc. So if I change this line
public event PropertyChangedEventHandler PropertyChanged;
To this ...
public virtual event PropertyChangedEventHandler PropertyChanged;
It works, but to me this doesn't seem like a great solution. NHibernate is treating that event property like it is a field it is going to persist into the database. Is there a way I can tell NHibernate to ignore it?
If I make it a 'virtual event' do you think WPF binding will still work with it?