예제 #1
0
 public void Initialize(
     JsonSourceGenerationMode generationMode,
     string typeRef,
     string typeInfoPropertyName,
     Type type,
     ClassType classType,
     bool isValueType,
     JsonNumberHandling?numberHandling,
     List <PropertyGenerationSpec>?propertiesMetadata,
     CollectionType collectionType,
     TypeGenerationSpec?collectionKeyTypeMetadata,
     TypeGenerationSpec?collectionValueTypeMetadata,
     ObjectConstructionStrategy constructionStrategy,
     TypeGenerationSpec?nullableUnderlyingTypeMetadata,
     string?converterInstantiationLogic)
 {
     GenerationMode       = generationMode;
     TypeRef              = $"global::{typeRef}";
     TypeInfoPropertyName = typeInfoPropertyName;
     Type                           = type;
     ClassType                      = classType;
     IsValueType                    = isValueType;
     CanBeNull                      = !isValueType || nullableUnderlyingTypeMetadata != null;
     NumberHandling                 = numberHandling;
     PropertiesMetadata             = propertiesMetadata;
     CollectionType                 = collectionType;
     CollectionKeyTypeMetadata      = collectionKeyTypeMetadata;
     CollectionValueTypeMetadata    = collectionValueTypeMetadata;
     ConstructionStrategy           = constructionStrategy;
     NullableUnderlyingTypeMetadata = nullableUnderlyingTypeMetadata;
     ConverterInstantiationLogic    = converterInstantiationLogic;
 }
예제 #2
0
 public void Initialize(
     JsonSourceGenerationMode generationMode,
     Type type,
     ClassType classType,
     JsonNumberHandling?numberHandling,
     List <PropertyGenerationSpec>?propertyGenSpecList,
     ParameterGenerationSpec[]?ctorParamGenSpecArray,
     CollectionType collectionType,
     TypeGenerationSpec?collectionKeyTypeMetadata,
     TypeGenerationSpec?collectionValueTypeMetadata,
     ObjectConstructionStrategy constructionStrategy,
     TypeGenerationSpec?nullableUnderlyingTypeMetadata,
     string?converterInstantiationLogic,
     bool implementsIJsonOnSerialized,
     bool implementsIJsonOnSerializing)
 {
     GenerationMode       = generationMode;
     TypeRef              = type.GetCompilableName();
     TypeInfoPropertyName = type.GetTypeInfoPropertyName();
     Type                           = type;
     ClassType                      = classType;
     IsValueType                    = type.IsValueType;
     CanBeNull                      = !IsValueType || nullableUnderlyingTypeMetadata != null;
     NumberHandling                 = numberHandling;
     PropertyGenSpecList            = propertyGenSpecList;
     CtorParamGenSpecArray          = ctorParamGenSpecArray;
     CollectionType                 = collectionType;
     CollectionKeyTypeMetadata      = collectionKeyTypeMetadata;
     CollectionValueTypeMetadata    = collectionValueTypeMetadata;
     ConstructionStrategy           = constructionStrategy;
     NullableUnderlyingTypeMetadata = nullableUnderlyingTypeMetadata;
     ConverterInstantiationLogic    = converterInstantiationLogic;
     ImplementsIJsonOnSerialized    = implementsIJsonOnSerialized;
     ImplementsIJsonOnSerializing   = implementsIJsonOnSerializing;
 }
예제 #3
0
 public void Initialize(
     JsonSourceGenerationMode generationMode,
     Type type,
     ClassType classType,
     JsonNumberHandling?numberHandling,
     List <PropertyGenerationSpec>?propertyGenSpecList,
     ParameterGenerationSpec[]?ctorParamGenSpecArray,
     CollectionType collectionType,
     TypeGenerationSpec?collectionKeyTypeMetadata,
     TypeGenerationSpec?collectionValueTypeMetadata,
     ObjectConstructionStrategy constructionStrategy,
     TypeGenerationSpec?nullableUnderlyingTypeMetadata,
     string?runtimeTypeRef,
     TypeGenerationSpec?extensionDataPropertyTypeSpec,
     string?converterInstantiationLogic,
     bool implementsIJsonOnSerialized,
     bool implementsIJsonOnSerializing,
     bool hasTypeFactoryConverter,
     bool canContainNullableReferenceAnnotations,
     bool hasPropertyFactoryConverters,
     bool isPolymorphic)
 {
     GenerationMode       = generationMode;
     TypeRef              = type.GetCompilableName();
     TypeInfoPropertyName = type.GetTypeInfoPropertyName();
     Type                                   = type;
     ClassType                              = classType;
     IsValueType                            = type.IsValueType;
     CanBeNull                              = !IsValueType || nullableUnderlyingTypeMetadata != null;
     IsPolymorphic                          = isPolymorphic;
     NumberHandling                         = numberHandling;
     PropertyGenSpecList                    = propertyGenSpecList;
     CtorParamGenSpecArray                  = ctorParamGenSpecArray;
     CollectionType                         = collectionType;
     CollectionKeyTypeMetadata              = collectionKeyTypeMetadata;
     CollectionValueTypeMetadata            = collectionValueTypeMetadata;
     ConstructionStrategy                   = constructionStrategy;
     NullableUnderlyingTypeMetadata         = nullableUnderlyingTypeMetadata;
     RuntimeTypeRef                         = runtimeTypeRef;
     ExtensionDataPropertyTypeSpec          = extensionDataPropertyTypeSpec;
     ConverterInstantiationLogic            = converterInstantiationLogic;
     ImplementsIJsonOnSerialized            = implementsIJsonOnSerialized;
     ImplementsIJsonOnSerializing           = implementsIJsonOnSerializing;
     CanContainNullableReferenceAnnotations = canContainNullableReferenceAnnotations;
     HasTypeFactoryConverter                = hasTypeFactoryConverter;
     HasPropertyFactoryConverters           = hasPropertyFactoryConverters;
 }
예제 #4
0
        public void Initialize(
            string compilableName,
            string friendlyName,
            Type type,
            ClassType classType,
            bool isValueType,
            JsonNumberHandling?numberHandling,
            List <PropertyMetadata>?propertiesMetadata,
            CollectionType collectionType,
            TypeMetadata?collectionKeyTypeMetadata,
            TypeMetadata?collectionValueTypeMetadata,
            ObjectConstructionStrategy constructionStrategy,
            TypeMetadata?nullableUnderlyingTypeMetadata,
            string?converterInstantiationLogic,
            bool containsOnlyPrimitives)
        {
            if (_hasBeenInitialized)
            {
                throw new InvalidOperationException("Type metadata has already been initialized.");
            }

            _hasBeenInitialized = true;

            CompilableName                 = compilableName;
            FriendlyName                   = friendlyName;
            Type                           = type;
            ClassType                      = classType;
            IsValueType                    = isValueType;
            NumberHandling                 = numberHandling;
            PropertiesMetadata             = propertiesMetadata;
            CollectionType                 = collectionType;
            CollectionKeyTypeMetadata      = collectionKeyTypeMetadata;
            CollectionValueTypeMetadata    = collectionValueTypeMetadata;
            ConstructionStrategy           = constructionStrategy;
            NullableUnderlyingTypeMetadata = nullableUnderlyingTypeMetadata;
            ConverterInstantiationLogic    = converterInstantiationLogic;
            ContainsOnlyPrimitives         = containsOnlyPrimitives;
        }