private void ExportServicesToConfig( ServiceSettingsElement childElement, ServiceSettingsElement parentElement, List <IService> childServices) { if (childServices == null) { return; } foreach (IService childService in childServices) { ServiceSettingsElement serviceSettingsElement = new ServiceSettingsElement(); if (childService.ExposedState != ExposedServiceStateType.NonExposed) { this.AppendMethodsToConfig(serviceSettingsElement, (IEnumerable <IMethod>)childService.Methods); } serviceSettingsElement.ExposedType = childService.ExposedState; serviceSettingsElement.Name = childService.Name; childElement.Children.Add(serviceSettingsElement); this.ExportServicesToConfig(serviceSettingsElement, childElement, childService.Children); } if (childElement.Children.Count != 0 || childElement.ExposedType != ExposedServiceStateType.NonExposed || parentElement == null) { return; } parentElement.Children.Remove(childElement.Name); }
private void ImportServicesFromConfig(ServiceSettingsElement parentElement, IService parentServ) { if (parentElement == null || parentServ == null) { return; } foreach (ServiceSettingsElement child1 in (ConfigurationElementCollection)parentElement.Children) { IService child2 = parentServ.FindChild(child1.Name); if (child2 != null) { this.ImportServicesFromConfig(child1, child2); if (child1.ExposedType != ExposedServiceStateType.NonExposed) { child2.ExposedState = child1.ExposedType; this.ImportMethodsFromConfig(child1.Methods, (IEnumerable <IMethod>)child2.Methods); } } } }
private void AppendMethodsToConfig( ServiceSettingsElement newServElement, IEnumerable <IMethod> methods) { if (methods == null) { return; } foreach (IMethod method in methods) { if (method.ExposedState != ExposedMethodStateType.NonExposed) { newServElement.Methods.Add(new MethodElement() { ExposedType = method.ExposedState, Name = method.Name }); } } }
public void Add(ServiceSettingsElement myElement) { this.BaseAdd((ConfigurationElement)myElement); }