예제 #1
0
        public ProtobufInputFormatter(ProtobufFormatterOptions protobufFormatterOptions)
        {
            _options = protobufFormatterOptions ?? throw new ArgumentNullException(nameof(protobufFormatterOptions));
            foreach (var contentType in protobufFormatterOptions.SupportedContentTypes)
            {
                SupportedMediaTypes.Add(new MediaTypeHeaderValue(contentType));
            }

            foreach (var surrogate in protobufFormatterOptions.Surrogates)
            {
                model.Value.Add(surrogate.Key, false).SetSurrogate(surrogate.Value);
            }
        }