Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Implement CanReadType in InputFormatter #1974

Closed
ajaybhargavb opened this issue Feb 7, 2015 · 1 comment
Closed

Implement CanReadType in InputFormatter #1974

ajaybhargavb opened this issue Feb 7, 2015 · 1 comment
Assignees
Milestone

Comments

@ajaybhargavb
Copy link
Contributor

Currently the CanReadType is missing in InputFormatter.

WebAPI Code for this:

public override bool CanReadType(Type type)
{
        if (type == null)
        {
                throw Error.ArgumentNull("type");
        }

        // If there is a registered non-null serializer, we can support this type.
        // Otherwise attempt to create the default serializer.
        object serializer = GetCachedSerializer(type, throwOnError: false);

        // Null means we tested it before and know it is not supported
        return serializer != null;
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants