internal JsonPropertyInfo CreatePolymorphicProperty(JsonPropertyInfo property, Type runtimePropertyType, JsonSerializerOptions options)
        {
            ClassType classType = GetClassType(
                runtimePropertyType,
                Type,
                property.PropertyInfo,
                out _,
                out Type elementType,
                out Type nullableType,
                out _,
                out JsonConverter converter,
                checkForAddMethod: false,
                options);

            JsonPropertyInfo runtimeProperty = CreateProperty(
                property.DeclaredPropertyType,
                runtimePropertyType,
                property.PropertyInfo,
                parentClassType: Type,
                collectionElementType: elementType,
                nullableType,
                converter,
                classType,
                options: options);

            property.CopyRuntimeSettingsTo(runtimeProperty);

            return(runtimeProperty);
        }
Esempio n. 2
0
        internal JsonPropertyInfo CreatePolymorphicProperty(JsonPropertyInfo property, Type runtimePropertyType, JsonSerializerOptions options)
        {
            JsonPropertyInfo runtimeProperty = CreateProperty(property.DeclaredPropertyType, runtimePropertyType, property.ImplementedPropertyType, property?.PropertyInfo, Type, options);

            property.CopyRuntimeSettingsTo(runtimeProperty);

            return(runtimeProperty);
        }