コード例 #1
0
 public IEnumerable <ConfigEnpointData> GetServiceEndpoints(ConfigServiceData service)
 {
     foreach (var contractInterface in service.ServiceType.GetInterfaces().Where(inf => ConfigExtensions.IsServiceContract(inf)))
     {
         yield return(new ConfigEnpointData(contractInterface.FullName, GetBindingName(), contractInterface.Name));
     }
     if (_isGeneratingMetadataEndpoint)
     {
         yield return(new ConfigEnpointData("IMetadataExchange", "mexHttpBinding", "mex"));
     }
 }
コード例 #2
0
 public IEnumerable<ConfigEnpointData> GetServiceEndpoints(ConfigServiceData service)
 {
     foreach (var contractInterface in service.ServiceType.GetInterfaces().Where(inf => ConfigExtensions.IsServiceContract(inf)))
     {
         yield return new ConfigEnpointData(contractInterface.FullName, GetBindingName(), contractInterface.Name);
     }
     if (_isGeneratingMetadataEndpoint)
     {
         yield return new ConfigEnpointData("IMetadataExchange", "mexHttpBinding", "mex");
     }
 }
コード例 #3
0
        public HttpConfigurationStrategy(IEnumerable <Type> serviceTypes, bool isGeneratingMetadataEndpoint = false)
        {
            foreach (var serviceType in serviceTypes)
            {
                var serviceData = new ConfigServiceData(serviceType);
                serviceData.Endpoints = GetServiceEndpoints(serviceData);
                if (isGeneratingMetadataEndpoint)
                {
                    string behaviorName = serviceType.Name + "Behavior";
                    serviceData.BehaviorName = behaviorName;
                    ConfigServiceBehaviorData behavior = new ConfigServiceBehaviorData()
                    {
                        Name    = behaviorName,
                        Content = new XElement("behavior", new XAttribute("name", behaviorName),
                                               new XElement("serviceMetadata", new XAttribute("httpGetEnabled", true)),
                                               new XElement("serviceDebug", new XAttribute("includeExceptionDetailInFaults", true)))
                    };
                    _serviceBehaviors.Add(behavior);
                }
                _services.Add(serviceData);
            }

            _isGeneratingMetadataEndpoint = isGeneratingMetadataEndpoint;
        }
コード例 #4
0
        public HttpConfigurationStrategy(IEnumerable<Type> serviceTypes, bool isGeneratingMetadataEndpoint = false)
        {
            foreach (var serviceType in serviceTypes)
            {
                var serviceData = new ConfigServiceData(serviceType);
                serviceData.Endpoints = GetServiceEndpoints(serviceData);
                if (isGeneratingMetadataEndpoint)
                {
                    string behaviorName = serviceType.Name + "Behavior";
                    serviceData.BehaviorName = behaviorName;
                    ConfigServiceBehaviorData behavior = new ConfigServiceBehaviorData()
                                                             {
                                                                 Name = behaviorName,
                                                                 Content = new XElement("behavior", new XAttribute("name", behaviorName),
                                                                                        new XElement("serviceMetadata", new XAttribute("httpGetEnabled", true)),
                                                                                        new XElement("serviceDebug", new XAttribute("includeExceptionDetailInFaults", true)))
                                                             };
                    _serviceBehaviors.Add(behavior);
                }
                _services.Add(serviceData);
            }

            _isGeneratingMetadataEndpoint = isGeneratingMetadataEndpoint;
        }