Exemple #1
0
        //After configure called
        public static void AfterInit()
        {
            if (config.EnableFeatures != Feature.All)
            {
                if ((Feature.Xml & config.EnableFeatures) != Feature.Xml)
                {
                    config.IgnoreFormatsInMetadata.Add("xml");
                }
                if ((Feature.Json & config.EnableFeatures) != Feature.Json)
                {
                    config.IgnoreFormatsInMetadata.Add("json");
                }
                if ((Feature.Jsv & config.EnableFeatures) != Feature.Jsv)
                {
                    config.IgnoreFormatsInMetadata.Add("jsv");
                }
                if ((Feature.Csv & config.EnableFeatures) != Feature.Csv)
                {
                    config.IgnoreFormatsInMetadata.Add("csv");
                }
                if ((Feature.Html & config.EnableFeatures) != Feature.Html)
                {
                    config.IgnoreFormatsInMetadata.Add("html");
                }
                if ((Feature.Soap11 & config.EnableFeatures) != Feature.Soap11)
                {
                    config.IgnoreFormatsInMetadata.Add("soap11");
                }
                if ((Feature.Soap12 & config.EnableFeatures) != Feature.Soap12)
                {
                    config.IgnoreFormatsInMetadata.Add("soap12");
                }
            }

            if ((Feature.Html & config.EnableFeatures) == Feature.Html)
            {
                HtmlFormat.Register(AppHost);
            }

            if ((Feature.Csv & config.EnableFeatures) == Feature.Csv)
            {
                CsvFormat.Register(AppHost);
            }

            if ((Feature.Markdown & config.EnableFeatures) == Feature.Markdown)
            {
                MarkdownFormat.Instance.MarkdownBaseType      = config.MarkdownBaseType;
                MarkdownFormat.Instance.MarkdownGlobalHelpers = config.MarkdownGlobalHelpers;
                MarkdownFormat.Instance.Register(AppHost);
            }

            config.ServiceManager.AfterInit();
        }
Exemple #2
0
        // Pre user config
        public static void ConfigureHost(IAppHost appHost, string serviceName, Assembly[] assembliesWithServices)
        {
            AppHost = appHost;

            EndpointHostConfig.Instance.ServiceName    = serviceName;
            EndpointHostConfig.Instance.ServiceManager = new ServiceManager(assembliesWithServices);

            var config = EndpointHostConfig.Instance;

            Config = config;         // avoid cross-dependency on Config setter

            ContentCacheManager.ContentTypeFilter = appHost.ContentTypeFilters;
            HtmlFormat.Register(appHost);
            CsvFormat.Register(appHost);
        }
Exemple #3
0
        //After configure called
        public static void AfterInit()
        {
            var specifiedContentType = config.DefaultContentType;

            if (config.EnableFeatures != Feature.All)
            {
                if ((Feature.Xml & config.EnableFeatures) != Feature.Xml)
                {
                    config.IgnoreFormatsInMetadata.Add("xml");
                }
                if ((Feature.Json & config.EnableFeatures) != Feature.Json)
                {
                    config.IgnoreFormatsInMetadata.Add("json");
                }
                if ((Feature.Jsv & config.EnableFeatures) != Feature.Jsv)
                {
                    config.IgnoreFormatsInMetadata.Add("jsv");
                }
                if ((Feature.Csv & config.EnableFeatures) != Feature.Csv)
                {
                    config.IgnoreFormatsInMetadata.Add("csv");
                }
                if ((Feature.Html & config.EnableFeatures) != Feature.Html)
                {
                    config.IgnoreFormatsInMetadata.Add("html");
                }
                if ((Feature.Soap11 & config.EnableFeatures) != Feature.Soap11)
                {
                    config.IgnoreFormatsInMetadata.Add("soap11");
                }
                if ((Feature.Soap12 & config.EnableFeatures) != Feature.Soap12)
                {
                    config.IgnoreFormatsInMetadata.Add("soap12");
                }
            }

            if ((Feature.Html & config.EnableFeatures) == Feature.Html)
            {
                HtmlFormat.Register(AppHost);
            }

            if ((Feature.Csv & config.EnableFeatures) == Feature.Csv)
            {
                CsvFormat.Register(AppHost);
            }

            if ((Feature.Markdown & config.EnableFeatures) == Feature.Markdown)
            {
                MarkdownFormat.Instance.MarkdownBaseType      = config.MarkdownBaseType;
                MarkdownFormat.Instance.MarkdownGlobalHelpers = config.MarkdownGlobalHelpers;
                MarkdownFormat.Instance.Register(AppHost);
            }

            if (!string.IsNullOrEmpty(specifiedContentType))
            {
                config.DefaultContentType = specifiedContentType;
            }
            else if (string.IsNullOrEmpty(config.DefaultContentType))
            {
                config.DefaultContentType = ContentType.Json;
            }

            config.ServiceManager.AfterInit();
        }