code_junkie

Web services and interface compatibility

Nov 14th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public class WcfClient<T> : ClientBase<T> where T : class
  2. {
  3. public new T Channel {get {return base.Channel;}}
  4. }
  5.  
  6. using(var client = new WcfClient<IFoo>())
  7. {
  8. client.Channel.Bar(); // defined by IFoo
  9. }
  10.  
  11. public class WcfClient<T> : ClientBase<T>, IDisposable where T : class
  12. {
  13. public new T Channel {get {return base.Channel;}}
  14. void IDisposable.Dispose() {
  15. try {
  16. switch(State) {
  17. case CommunicationState.Open: Close(); break;
  18. // etc
  19. }
  20. } catch {} // swallow it down (perhaps log it first)
  21. }
  22. }
Add Comment
Please, Sign In to add comment