Since VB cannot define an event as virtual and this would prevent the use of INotifyPropertyChanged i.c.w. Lazy loading this is the workaround. Add a C# project to the VB solution in which you define an abstract base class that implents the virtual event. Then let the VB classes inherit from that class. It is not good OO practice but it works ;-)
So for example in C# dll
Code:
using System;
using System.ComponentModel;
namespace MAF.DB.Foundation
{
public abstract class NotifyPropertyChangedFoundation : INotifyPropertyChanged
{
public virtual event PropertyChangedEventHandler PropertyChanged;
public virtual void NotifyPropertyChanged(String Information)
{
if (PropertyChanged != null)
{
NotifyPropertyChanged(Information, this);
}
}
public virtual void NotifyPropertyChanged(String Information, object sender)
{
if (PropertyChanged != null)
{
if (sender == null) { sender = this; }
PropertyChanged(sender, new PropertyChangedEventArgs(Information));
}
}
}
}
And then in VB
Code:
Namespace MAF.DB.BusinessObject
Public MustInherit Class BusinessObjectBase
Inherits DB.Foundation.NotifyPropertyChangedFoundation 'Implements INotifyPropertyChanged
... etc
End Class