예제 #1
0
            public PropertyTypeReferences(TypeReference typeReference, ComplexType complexType, CollectionKind collectionKind, ClientApiGenerator generator)
            {
                CodeTypeReference baseType = generator.GetLeastPossibleQualifiedTypeReference(complexType);

                baseType     = GetCollectionTypeReference(typeReference, baseType, collectionKind);
                _nonNullable = baseType;
                _nullable    = baseType;
            }
예제 #2
0
        private void EmitKnownTypeAttributes(EdmType baseType, ClientApiGenerator generator, CodeTypeDeclaration typeDecl)
        {
            foreach (EdmType edmType in generator.GetDirectSubTypes(baseType))
            {
                Debug.Assert(edmType.BaseType == baseType, "The types must be directly derived from basetype");

                CodeTypeReference subTypeRef;
                if (generator.Language == LanguageOption.GenerateCSharpCode)
                {
                    bool useGlobalPrefix = true;
                    subTypeRef = generator.GetFullyQualifiedTypeReference(edmType, useGlobalPrefix);
                }
                else
                {
                    Debug.Assert(generator.Language == LanguageOption.GenerateVBCode, "Did you add a new language?");
                    subTypeRef = generator.GetLeastPossibleQualifiedTypeReference(edmType);
                }
                CodeAttributeDeclaration attribute = EmitSimpleAttribute("System.Runtime.Serialization.KnownTypeAttribute", new CodeTypeOfExpression(subTypeRef));
                typeDecl.CustomAttributes.Add(attribute);
            }
        }
 private void EmitKnownTypeAttributes(EdmType baseType, ClientApiGenerator generator, CodeTypeDeclaration typeDecl)
 {
     foreach (EdmType edmType in generator.GetDirectSubTypes(baseType))
     {
         Debug.Assert(edmType.BaseType == baseType, "The types must be directly derived from basetype");
         
         CodeTypeReference subTypeRef;
         if (generator.Language == LanguageOption.GenerateCSharpCode)
         {
             bool useGlobalPrefix = true;
             subTypeRef = generator.GetFullyQualifiedTypeReference(edmType, useGlobalPrefix);
         }
         else
         {
             Debug.Assert(generator.Language == LanguageOption.GenerateVBCode, "Did you add a new language?");
             subTypeRef = generator.GetLeastPossibleQualifiedTypeReference(edmType);
         }
         CodeAttributeDeclaration attribute = EmitSimpleAttribute("System.Runtime.Serialization.KnownTypeAttribute", new CodeTypeOfExpression(subTypeRef));
         typeDecl.CustomAttributes.Add(attribute);
     }
 }