Skip to content
This repository was archived by the owner on Jan 24, 2021. It is now read-only.

External serializer does not take existing instance into account when using BindTo #1383

@thecodejunkie

Description

@thecodejunkie

This is related to #1376

It looks like the the Nancy.Serializers.* does not take into account that when you call BindTo then the BindingContext can contain an existing instance that should be bound to, they will always try to create a new instance

https://github.com/NancyFx/Nancy.Serialization.JsonNet/blob/master/src/Nancy.Serialization.JsonNet/JsonNetBodyDeserializer.cs#L81

The same holds true for the ServiceStack serialization package

https://github.com/NancyFx/Nancy.Serialization.ServiceStack/blob/master/src/Nancy.Serialization.ServiceStack/Nancy.Serialization.ServiceStack/ServiceStackBodyDeserializer.cs#L46

We need to make sure we can distinguish an existing instance from a created one, because the Model is set by the DefaultBinder

https://github.com/NancyFx/Nancy/blob/master/src/Nancy/ModelBinding/DefaultBinder.cs#L334

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions