Пример #1
0
 /// <summary>
 /// Initializes the singletons of the application.
 /// </summary>
 /// <param name="node">The node.</param>
 private static void InitializeSingleton(XmlNode node)
 {
     NodeAttributes attributes = new NodeAttributes(node);
     string interfaceTypeName = attributes.AsString("interfaceType");
     string objectTypeName = attributes.AsString("objectType");
     Type objectType = TypesManager.ResolveType(objectTypeName);
     Type interfaceType = null;
     if (interfaceTypeName == null)
     {
         interfaceType = objectType;
     }
     else
     {
         interfaceType = TypesManager.ResolveType(interfaceTypeName);
     }
     IList<object> parameters = new List<object>();
     foreach (XmlNode parameterNode in node.SelectNodes("parameters/parameter"))
     {
         parameters.Add(parameterNode.InnerText);
     }
     object item;
     if (parameters.Count > 0)
     {
         item = Activator.CreateInstance(objectType, parameters.ToArray());
     }
     else
     {
         item = Activator.CreateInstance(objectType);
     }
     IoC.Register(interfaceType, item);
 }
Пример #2
0
 /// <summary>
 /// Initializes the discover services of the application.
 /// </summary>
 /// <param name="node">The node.</param>
 private static void InitializeDiscover(XmlNode node)
 {
     NodeAttributes attributes = new NodeAttributes(node);
     ServiceDiscover.DiscoverServices(attributes.AsString("path"), attributes.AsString("assembly"), attributes.AsBool("cors"));
 }
Пример #3
0
 /// <summary>
 /// Loads the actions.
 /// </summary>
 /// <param name="node">The node.</param>
 public void LoadActions(XmlNode node, string path)
 {
     foreach (XmlNode actionNode in node.SelectNodes("actions/action"))
     {
         NodeAttributes attributes = new NodeAttributes(actionNode);
         TemplateAction action = new TemplateAction(this, attributes.AsString("type"), path + "\\" + attributes.AsString("source"), attributes.AsString("target"));
         this.Actions.Add(action);
     }
 }