ContractCodeDomInfo.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------
  4. namespace System.Runtime.Serialization
  5. {
  6. using System;
  7. using System.Xml;
  8. using System.Xml.Schema;
  9. using System.CodeDom;
  10. using System.Collections.Generic;
  11. internal class ContractCodeDomInfo
  12. {
  13. internal bool IsProcessed;
  14. internal CodeTypeDeclaration TypeDeclaration;
  15. internal CodeTypeReference TypeReference;
  16. internal CodeNamespace CodeNamespace;
  17. internal bool ReferencedTypeExists;
  18. internal bool UsesWildcardNamespace;
  19. string clrNamespace;
  20. Dictionary<string, object> memberNames;
  21. internal string ClrNamespace
  22. {
  23. get { return (ReferencedTypeExists ? null : clrNamespace); }
  24. set
  25. {
  26. if (ReferencedTypeExists)
  27. throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CannotSetNamespaceForReferencedType, TypeReference.BaseType)));
  28. else
  29. clrNamespace = value;
  30. }
  31. }
  32. internal Dictionary<string, object> GetMemberNames()
  33. {
  34. if (ReferencedTypeExists)
  35. throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CannotSetMembersForReferencedType, TypeReference.BaseType)));
  36. else
  37. {
  38. if (memberNames == null)
  39. {
  40. memberNames = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
  41. }
  42. return memberNames;
  43. }
  44. }
  45. }
  46. }