Exemple #1
0
        public static void AssertTestConfig(params Assembly[] assemblies)
        {
            if (Config != null)
            {
                return;
            }

            var config = EndpointHostConfig.Instance;

            config.ServiceName    = "Test Services";
            config.ServiceManager = new ServiceManager(assemblies.Length == 0 ? new[] { Assembly.GetCallingAssembly() } : assemblies);
            Config = config;
        }
Exemple #2
0
        public void SetConfig(EndpointHostConfig config)
        {
            if (config.ServiceName == null)
            {
                config.ServiceName = EndpointHostConfig.Instance.ServiceName;
            }

            if (config.ServiceManager == null)
            {
                config.ServiceManager = EndpointHostConfig.Instance.ServiceManager;
            }

            config.ServiceManager.ServiceController.EnableAccessRestrictions = config.EnableAccessRestrictions;

            EndpointHost.Config = config;
        }
Exemple #3
0
        private static void Reset()
        {
            ContentTypeFilter = HttpResponseFilter.Instance;
            RawRequestFilters = new List <Action <IHttpRequest, IHttpResponse> >();
            RequestFilters    = new List <Action <IHttpRequest, IHttpResponse, object> >();
            ResponseFilters   = new List <Action <IHttpRequest, IHttpResponse, object> >();
            ViewEngines       = new List <IViewEngine>();
            CatchAllHandlers  = new List <HttpHandlerResolverDelegate>();
            Plugins           = new List <IPlugin> {
                new HtmlFormat(),
                new CsvFormat(),
                new MarkdownFormat(),
                new PredefinedRoutesFeature(),
                new MetadataFeature(),
            };

            //Default Config for projects that want to use components but not WebFramework (e.g. MVC)
            Config = new EndpointHostConfig(
                "Empty Config",
                new ServiceManager(new Container(), new ServiceController(null)));
        }