System.Configuration.ContextInformation.GetSection C# (CSharp) Метод

GetSection() публичный Метод

public GetSection ( string sectionName ) : object
sectionName string
Результат object
        public object GetSection(string sectionName)
        {
            return _configRecord.GetSection(sectionName);
        }
    }

Usage Example

Пример #1
0
 /// <summary>
 /// Registers WCF services type mappings from the given configuration excluding specified endpoints if needed.
 /// </summary>
 public static IServiceCollection AddWcfServices(this IServiceCollection container, ContextInformation ctx, Func<ServiceEndpointElement, bool> exclEndpoints)
 {
     String servicesPath = "system.serviceModel/services";
     ServicesSection services = (ServicesSection)(ctx != null ? ctx.GetSection(servicesPath) : ConfigurationManager.GetSection(servicesPath));
     foreach (ServiceElement service in services.Services)
     {
         Type serviceType = GetType(service.Name);
         if (serviceType == null) continue;
         foreach (ServiceEndpointElement endpoint in service.Endpoints)
         {
             Type contractType = GetType(endpoint.Contract);
             if (contractType == null || endpoint.IsSystemEndpoint || exclEndpoints != null && exclEndpoints(endpoint)) continue;
             container.AddScoped(contractType, serviceType);
         }
     }
     return container;
 }
All Usage Examples Of System.Configuration.ContextInformation::GetSection