Hello,
I have problem with Dynamic Proxy. I have a class which has logic in constructor. Like this:
public class Document
{
public ExtraList<Foo> Possitions {get; set;}
public Document()
{
Possitions = new ExtraList<Foo>();
}
}
where 'ExtraList' is a special list which can have setted a property of object 'Foo' which have to be only one at list. So next thing is that this object have to be binded to GUI on WinForms. So i wanted ton implement INotifyPropertyChanged by Dynamic Proxy 2 by interceptor. That's cool :)
It looks like this:
public static T GenerateProxy<T>(T model, SynchronizationContext synchronizationContext, Type type)
{
var boundModelInterceptor = new BoundModelInterceptor(model, synchronizationContext);
T modelProxy;
modelProxy = (T)_proxyGenerator.CreateClassProxy(
typeof(T),
new[] { typeof(INotifyPropertyChanged) },
boundModelInterceptor);
boundModelInterceptor.PropertyChangedTarget = modelProxy;
return modelProxy;
}
I have programmed it and now I have a problem that after making class by proxy my list (Possitions) is null but in undelying list it's created. I can not make this list by proxy generator because presenter does not know about domain model logic.
How can I make it work?