Пример #1
0
        // Config has changed
        private static void ApplyConfigChanges()
        {
            config.ServiceEndpointsMetadataConfig = ServiceEndpointsMetadataConfig.Create(config.ServiceStackHandlerFactoryPath);

            JsonDataContractSerializer.Instance.UseBcl   = config.UseBclJsonSerializers;
            JsonDataContractDeserializer.Instance.UseBcl = config.UseBclJsonSerializers;
        }
Пример #2
0
        public MetadataPagesConfig(
            ServiceMetadata metadata,
            ServiceEndpointsMetadataConfig metadataConfig,
            HashSet<string> ignoredFormats,
            List<string> contentTypeFormats)
        {
            this.ignoredFormats = ignoredFormats;
            this.metadata = metadata;

            metadataConfigMap = new Dictionary<string, MetadataConfig> {
                {"xml", metadataConfig.Xml},
                {"json", metadataConfig.Json},
                {"jsv", metadataConfig.Jsv},
                {"soap11", metadataConfig.Soap11},
                {"soap12", metadataConfig.Soap12},
            };

            AvailableFormatConfigs = new List<MetadataConfig>();

            var config = GetMetadataConfig("xml");
            if (config != null) AvailableFormatConfigs.Add(config);
            config = GetMetadataConfig("json");
            if (config != null) AvailableFormatConfigs.Add(config);
            config = GetMetadataConfig("jsv");
            if (config != null) AvailableFormatConfigs.Add(config);

            foreach (var format in contentTypeFormats)
            {
                metadataConfigMap[format] = metadataConfig.Custom.Create(format);

                config = GetMetadataConfig(format);
                if (config != null) AvailableFormatConfigs.Add(config);
            }

            config = GetMetadataConfig("soap11");
            if (config != null) AvailableFormatConfigs.Add(config);
            config = GetMetadataConfig("soap12");
            if (config != null) AvailableFormatConfigs.Add(config);
        }