ServiceContractGenerationContext.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Description
  5. {
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Collections.ObjectModel;
  9. using System.CodeDom;
  10. using System.CodeDom.Compiler;
  11. public class ServiceContractGenerationContext
  12. {
  13. readonly ServiceContractGenerator serviceContractGenerator;
  14. readonly ContractDescription contract;
  15. readonly CodeTypeDeclaration contractType;
  16. readonly CodeTypeDeclaration duplexCallbackType;
  17. readonly Collection<OperationContractGenerationContext> operations = new Collection<OperationContractGenerationContext>();
  18. CodeNamespace codeNamespace;
  19. CodeTypeDeclaration channelType;
  20. CodeTypeReference channelTypeReference;
  21. CodeTypeDeclaration clientType;
  22. CodeTypeReference clientTypeReference;
  23. CodeTypeReference contractTypeReference;
  24. CodeTypeReference duplexCallbackTypeReference;
  25. ServiceContractGenerator.CodeTypeFactory typeFactory;
  26. public ServiceContractGenerationContext(ServiceContractGenerator serviceContractGenerator, ContractDescription contract, CodeTypeDeclaration contractType)
  27. {
  28. if (serviceContractGenerator == null)
  29. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("serviceContractGenerator"));
  30. if (contract == null)
  31. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("contract"));
  32. if (contractType == null)
  33. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("contractType"));
  34. this.serviceContractGenerator = serviceContractGenerator;
  35. this.contract = contract;
  36. this.contractType = contractType;
  37. }
  38. public ServiceContractGenerationContext(ServiceContractGenerator serviceContractGenerator, ContractDescription contract, CodeTypeDeclaration contractType, CodeTypeDeclaration duplexCallbackType)
  39. : this(serviceContractGenerator, contract, contractType)
  40. {
  41. this.duplexCallbackType = duplexCallbackType;
  42. }
  43. internal CodeTypeDeclaration ChannelType
  44. {
  45. get { return this.channelType; }
  46. set { this.channelType = value; }
  47. }
  48. internal CodeTypeReference ChannelTypeReference
  49. {
  50. get { return this.channelTypeReference; }
  51. set { this.channelTypeReference = value; }
  52. }
  53. internal CodeTypeDeclaration ClientType
  54. {
  55. get { return this.clientType; }
  56. set { this.clientType = value; }
  57. }
  58. internal CodeTypeReference ClientTypeReference
  59. {
  60. get { return this.clientTypeReference; }
  61. set { this.clientTypeReference = value; }
  62. }
  63. public ContractDescription Contract
  64. {
  65. get { return this.contract; }
  66. }
  67. public CodeTypeDeclaration ContractType
  68. {
  69. get { return this.contractType; }
  70. }
  71. internal CodeTypeReference ContractTypeReference
  72. {
  73. get { return this.contractTypeReference; }
  74. set { this.contractTypeReference = value; }
  75. }
  76. public CodeTypeDeclaration DuplexCallbackType
  77. {
  78. get { return this.duplexCallbackType; }
  79. }
  80. internal CodeTypeReference DuplexCallbackTypeReference
  81. {
  82. get { return this.duplexCallbackTypeReference; }
  83. set { this.duplexCallbackTypeReference = value; }
  84. }
  85. internal CodeNamespace Namespace
  86. {
  87. get { return this.codeNamespace; }
  88. set { this.codeNamespace = value; }
  89. }
  90. public Collection<OperationContractGenerationContext> Operations
  91. {
  92. get { return this.operations; }
  93. }
  94. public ServiceContractGenerator ServiceContractGenerator
  95. {
  96. get { return this.serviceContractGenerator; }
  97. }
  98. internal ServiceContractGenerator.CodeTypeFactory TypeFactory
  99. {
  100. get { return this.typeFactory; }
  101. set { this.typeFactory = value; }
  102. }
  103. }
  104. }