0

Ran into an issue with a class; I have a class that looks like:

public class MyPresenter
{
    public MyPresenter(IMyView view) { }
}

public class SomePresenter
{
    public SomePresenter(ISomeView view) { }
}

The custom views inherit from a base IView instance. I ran into a situation where I need to create a custom class on the fly that implements IMyView or ISomeView (depending on some scenario) and access the model, and I was thinking I could use a tool like Castle DynamicProxy to do it. But I'm not quite sure where to start, and I need to be able to create a custom IMyView or other class instance on the fly.

Thanks.

Brian Mains
  • 50,520
  • 35
  • 148
  • 257
  • What should the custom new class do ? That's quite important. You can easily create a "dumb" proxy with Castle DynamicProxy, that does nothing. – driis Oct 13 '10 at 17:02
  • I just the class to implement events/properties; if any methods, I don't even need them to work... – Brian Mains Oct 13 '10 at 18:37

1 Answers1

2

When I needed proxies, I found this tutorial from Krzysztof Koźmic to be invaluable.

jason
  • 236,483
  • 35
  • 423
  • 525
  • I did find that, but I had a hard time digging through to find what I was looking for. Maybe it's because it's late in the day :-) Was wondering if there was one concrete article on what I was trying to do. Thanks. – Brian Mains Oct 13 '10 at 18:39