/// <summary> /// Carga los modos de distribución /// </summary> internal DeploymentModelCollection Load(ProjectModel project, MLNode rootML) { DeploymentModelCollection deployments = new DeploymentModelCollection(); // Carga los datos foreach (MLNode nodeML in rootML.Nodes) { if (nodeML.Name == TagRoot) { DeploymentModel deployment = new DeploymentModel(); // Carga los datos LoadBase(nodeML, deployment); deployment.PathScriptsTarget = nodeML.Nodes[TagPathScriptsTarget].Value; deployment.PathFilesTarget = nodeML.Nodes[TagPathFilesTarget].Value; // Carga las conexiones y parámetros foreach (MLNode childML in nodeML.Nodes) { switch (childML.Name) { case TagConnection: if (!string.IsNullOrEmpty(childML.Attributes[TagKey].Value) && !string.IsNullOrEmpty(childML.Attributes[TagId].Value)) { deployment.Connections.Add(childML.Attributes[TagKey].Value, project.Connections.Search(childML.Attributes[TagId].Value) as DatabaseConnectionModel); } break; case TagScript: deployment.Scripts.Add(LoadScript(childML)); break; case TagFormatReportType: deployment.ReportFormatTypes.Add(childML.Value.GetEnum(DeploymentModel.ReportFormat.Xml)); break; } } // Carga los parámetros LoadParameters(nodeML, deployment.Parameters); // Añade los datos de la distribución deployments.Add(deployment); } } // Devuelve la colección de distribuciones return(deployments); }
/// <summary> /// Obtiene los nodos de distribución /// </summary> internal MLNodesCollection GetMLNodes(DeploymentModelCollection deployments) { MLNodesCollection nodesML = new MLNodesCollection(); // Crea los nodos foreach (DeploymentModel deployment in deployments) { MLNode rootML = GetMLNodeBase(TagRoot, deployment); // Añade los nodos de propiedades rootML.Nodes.Add(TagPathScriptsTarget, deployment.PathScriptsTarget); rootML.Nodes.Add(TagPathFilesTarget, deployment.PathFilesTarget); // Añade los datos de las conexiones foreach (KeyValuePair <string, DatabaseConnectionModel> item in deployment.Connections) { MLNode nodeML = rootML.Nodes.Add(TagConnection); // Añade los datos nodeML.Attributes.Add(TagKey, item.Key); nodeML.Attributes.Add(TagId, item.Value.GlobalId); } // Añade los parámetros rootML.Nodes.AddRange(GetMLParameters(deployment.Parameters)); // Añade los scripts rootML.Nodes.AddRange(GetMLScripts(deployment.Scripts)); // Añade los nodos con los tipos de salida foreach (DeploymentModel.ReportFormat format in deployment.ReportFormatTypes) { rootML.Nodes.Add(TagFormatReportType, format.ToString()); } // Añade el nodo a la colección nodesML.Add(rootML); } // Devuelve la colección de nodos return(nodesML); }