In question about usefulness of IoC Container, the winning submitter mentioned that with an IoC container you can take this:
public class UglyCustomer : INotifyPropertyChanged
{
private string _firstName;
public string FirstName
{
get { return _firstName; }
set
{
string oldValue = _firstName;
_firstName = value;
if(oldValue != value)
OnPropertyChanged("FirstName");
}
}
private string _lastName;
public string LastName
{
get { return _lastName; }
set
{
string oldValue = value;
_lastName = value;
if(oldValue != value)
OnPropertyChanged("LastName");
}
}
}
to this:
var bindingFriendlyInstance = IoC.Resolve<Customer>(new NotifyPropertyChangedWrapper());
Questions:
- Which magic IoC container provides this goodness?
- An example implementing this?
- Any downsides?
- In a project with complex dependencies, will I be crying when I try to apply data binding to these objects?