예제 #1
0
 public CurrentApiInformation(ImmutableLinkedList <Func <Type, IEnumerable <IMethodAuthorization> > > authorizations, ImmutableLinkedList <Func <MethodInfo, Func <ICallExecutionContext, IEnumerable <ICallFilter> > > > filters, ImmutableLinkedList <Func <Type, IEnumerable <string> > > prefixes, NamingConventions namingConventions, ImmutableLinkedList <Func <MethodInfo, bool> > methodFilters, bool enableDocumentation, DocumentationConfiguration documentationConfiguration, bool supportResponseCompression)
 {
     Authorizations             = authorizations;
     Filters                    = filters;
     Prefixes                   = prefixes;
     NamingConventions          = namingConventions;
     MethodFilters              = methodFilters;
     EnableDocumentation        = enableDocumentation;
     DocumentationConfiguration = documentationConfiguration;
     SupportResponseCompression = supportResponseCompression;
 }
예제 #2
0
        /// <summary>
        /// Gets an immutable representation of what the current configuration values are
        /// </summary>
        /// <returns></returns>
        public ICurrentApiInformation GetCurrentApiInformation()
        {
            //need to make a copy of naming convention so that if it changes current api information stays the same
            if (_currentNamingConventions == null)
            {
                _currentNamingConventions = new NamingConventions {
                    RouteNameGenerator = NamingConventions.RouteNameGenerator, MethodNameGenerator = NamingConventions.MethodNameGenerator
                };
            }
            else if (_currentNamingConventions.RouteNameGenerator != NamingConventions.RouteNameGenerator ||
                     _currentNamingConventions.MethodNameGenerator != NamingConventions.MethodNameGenerator)
            {
                _currentNamingConventions = new NamingConventions {
                    RouteNameGenerator = NamingConventions.RouteNameGenerator, MethodNameGenerator = NamingConventions.MethodNameGenerator
                };
            }

            return(new CurrentApiInformation(_authorizations, _filters, _prefixes, _currentNamingConventions, _methodFilters, _enableDocumentation, _configuration, _rpcConfiguration.Value.SupportResponseCompression));
        }