Skip to content

Add option to pass SerializationSurrogateProvider #178

@kemsky

Description

@kemsky
    protected override XmlObjectSerializer CreateXmlObjectSerializer(Type type)
    {
        var serializerSettings = new DataContractSerializerSettings
        {
            KnownTypes = GetKnownTypes()
        };

        var serializer = new DataContractSerializer(type, serializerSettings);

        serializer.SetSerializationSurrogateProvider(new ExpressionSurrogateProvider());

        return serializer;
    }

ISerializationSurrogateProvider allows to customize serialization and add support for unknown types.

PS. unfortunately, there is a bug in JSON serializer: dotnet/runtime#100553.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions