Example #1
0
        /// <summary>
        /// Get serializer based on context
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public IContentSerializer GetSerializer(HttpContext context)
        {
            if (_onlySerializer != null)
            {
                return(_onlySerializer.CanSerialize(context) ? _onlySerializer : null);
            }

            for (var i = 0; i < _serializers.Length; i++)
            {
                if (_serializers[i].CanSerialize(context))
                {
                    return(_serializers[i]);
                }
            }

            return(null);
        }