예제 #1
0
 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);
 }
예제 #2
0
 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);
             }
         }
     }
 }
예제 #3
0
 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
             });
         }
     }
 }
예제 #4
0
 public void Add(ServiceSettingsElement myElement)
 {
     this.BaseAdd((ConfigurationElement)myElement);
 }