code_junkie

WCF Client Inside SQL CLR

Nov 13th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. var p = new MyServiceClient(new CustomBinding(b), new EndpointAddress(uri));
  2. var result = p.Execute(); // Don't Dispose proxy or you'll lose the actual exception.
  3.  
  4. try {
  5. return result.Values;
  6. } finally {
  7. if (p.State != CommunicationState.Closed) {
  8. if (p.State != CommunicationState.Faulted) {
  9. p.Close();
  10. } else {
  11. p.Abort();
  12. }
  13. }
  14. }
  15.  
  16. var p = new MyServiceClient(new CustomBinding(b), new EndpointAddress(uri));
  17. var result = p.Execute(); // Don't Dispose proxy or you'll lose the actual exception.
  18.  
  19. try {
  20. return result.Values;
  21. } finally {
  22. if (p.State != CommunicationState.Closed) {
  23. if (p.State != CommunicationState.Faulted) {
  24. p.Close();
  25. } else {
  26. p.Abort();
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment