ProxyBuilder.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.ComIntegration
  5. {
  6. using System;
  7. using System.Runtime.InteropServices;
  8. using Microsoft.Win32;
  9. using System.Reflection;
  10. using System.Collections.Generic;
  11. using System.Threading;
  12. internal static class ProxyBuilder
  13. {
  14. internal static void Build(Dictionary<MonikerHelper.MonikerAttribute, string> propertyTable, ref Guid riid, IntPtr ppv)
  15. {
  16. if (IntPtr.Zero == ppv)
  17. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("ppv");
  18. Marshal.WriteIntPtr(ppv, IntPtr.Zero);
  19. string temp;
  20. IProxyCreator proxyCreator = null;
  21. if (propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.Wsdl, out temp))
  22. {
  23. proxyCreator = new WsdlServiceChannelBuilder(propertyTable);
  24. }
  25. else if (propertyTable.TryGetValue(MonikerHelper.MonikerAttribute.MexAddress, out temp))
  26. {
  27. proxyCreator = new MexServiceChannelBuilder(propertyTable);
  28. }
  29. else
  30. {
  31. proxyCreator = new TypedServiceChannelBuilder(propertyTable);
  32. }
  33. IProxyManager proxyManager = new ProxyManager(proxyCreator);
  34. Marshal.WriteIntPtr(ppv, OuterProxyWrapper.CreateOuterProxyInstance(proxyManager, ref riid));
  35. }
  36. }
  37. }