Cruft code. IoC to the rescue

后端 未结 4 1465
我在风中等你
我在风中等你 2021-01-30 23:08

In question about usefulness of IoC Container, the winning submitter mentioned that with an IoC container you can take this:

public class UglyCustomer : INotifyP         


        
4条回答
  •  情话喂你
    2021-01-30 23:43

    To do this in a generic way (i.e. a single piece of code implementing INotifyPropertyChanged for any class) use a proxy. There are lots of implementations around to do this with Castle.DynamicProxy or LinFu or Unity. These proxy libraries have good support in IoC containers, for example DynamicProxy has good integration with Castle Windsor and Unity interception (or whatever it's called) has obviously good integration with the Unity container.

提交回复
热议问题