/// <summary> /// Deserializa un objeto Metadata desde un archivo XML. /// </summary> /// <param name="pszFullPath">Ruta al archivo XML con el objeto Metadata serializado.</param> private void LoadMetaDataFromXml(string pszFullPath) { XmlSerializer oSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Fwk.DataBase.Metadata)); Stream oFileStream = null; try { oFileStream = File.OpenRead(pszFullPath); _Metadata = (Fwk.DataBase.Metadata)oSerializer.Deserialize(oFileStream); this.ConnectionOk = true; IsLoadedMetaDataFromXML = true; this.RefreshMetadata(); } catch (Exception ex) { MessageView.Show(ex); } finally { if (oFileStream != null) { oFileStream.Close(); } oFileStream = null; oSerializer = null; } }
internal void Add(CodeGenerator.FrmBase frm, CodeGeneratorCommon.GeneratorsType pGeneratorsType) { if (!_GeneratorsList.ContainsKey(pGeneratorsType)) { _GeneratorsList.Add(pGeneratorsType, frm); if (_Metadata == null) _Metadata = frm.Metadata; else frm.Metadata = _Metadata; } }
/// <summary> /// Carga el archivo LastAccess.xml /// </summary> protected void InitializeLastAccessSource() { try { _Metadata = new Fwk.DataBase.Metadata(); } catch (Exception ex) { //Common.WriteEntryEventLog("Error en InitializeLastAccessSource. Puede que no este bien formado el archivo LastAcces.xml", ex,1000, System.Diagnostics.EventLogEntryType.Error); StringBuilder message = new StringBuilder("Error en InitializeLastAccessSource. "); message.Append(Environment.NewLine); message.Append(Environment.NewLine); message.Append("AllMessageException: " + Environment.NewLine + Fwk.Exceptions.ExceptionHelper.GetAllMessageException(ex)); MessageView.Show(message.ToString()); } }
private void btnCargarSPs_Click(object sender, EventArgs e) { DateTime inicio = DateTime.Now; if (cnnDataBaseForm1.CnnStringChange) { Metadata m = new Metadata(); m.LoadStoreProcedures(); treeViewStoreProcedures1.StoreProcedures = m.StoreProcedures; } treeViewStoreProcedures1.LoadTreeView(); DateTime final = DateTime.Now; TimeSpan duracion = final - inicio; lblSPTimeToLoad.Text = duracion.TotalSeconds.ToString(); }
private void button3_Click(object sender, EventArgs e) { DateTime inicio = DateTime.Now; Fwk.DataBase.Metadata Metadata = new Metadata(); Metadata.LoadStoreProcedures(); StoreProcedures t = Metadata.StoreProcedures; //TreeNode wTreeNode = new TreeNode(cboTable.SelectedValue.ToString()); TreeNode wTreeNode = new TreeNode("StoreProcedures"); wTreeNode.Checked = true; treeView1.Nodes.Add(wTreeNode); GenerateChildNodes(wTreeNode, ref t); DateTime final = DateTime.Now; TimeSpan duracion = final - inicio; //double segundosTotales = duracion.TotalSeconds; lblSPTimeToLoad.Text = duracion.Seconds.ToString(); }
private void button1_Click(object sender, System.EventArgs e) { DateTime inicio = DateTime.Now; Fwk.DataBase.Metadata Metadata = new Metadata(); Metadata.LoadTables(); Tables t = Metadata.Tables; //TreeNode wTreeNode = new TreeNode(cboTable.SelectedValue.ToString()); TreeNode wTreeNode = new TreeNode("Tables"); wTreeNode.Checked = true; tvwChilds.Nodes.Add(wTreeNode); GenerateChildNodes(wTreeNode, ref t); DateTime final = DateTime.Now; TimeSpan duracion = final - inicio; lblTablesTimeToLoad.Text = duracion.TotalSeconds.ToString(); }
public void Generate() { StringBuilder logs = new StringBuilder(); logs.AppendLine("Following class will be generated:"); Metadata _metadata = new Metadata(_cnn); _metadata.LoadUserDefinedTypes(); _metadata.RefreshConnection(); FwkGeneratorHelper.UserDefinedTypes = _metadata.UserDefinedTypes; Fwk.CodeGenerator.FwkGeneratorHelper.TemplateSetting = FwkGenerator.TemplateSettingFactoty(); TreeNode entities = null; switch (_SelectedObject) { case CodeGeneratorCommon.SelectedObject.Tables: { entities = BEGenerator.GenCode(ctrlTreeViewTables1.CheckedTables); break; } case CodeGeneratorCommon.SelectedObject.Views: { entities = BEGenerator.GenCode(ctrlTreeViewViews1.CheckedTables); break; } } _GeneratedCodeList = new List<GeneratedCode>(); GeneratedCode wGeneratedCode = null; foreach (TreeNode nodeDac in entities.Nodes) { wGeneratedCode = (GeneratedCode)nodeDac.Tag; _GeneratedCodeList.Add(wGeneratedCode); logs.AppendLine(string.Concat(wGeneratedCode.Id, "DAC")); } IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService; dictionaryService.SetValue("GeneratedCodeList", _GeneratedCodeList.ToArray()); txtGenerationResult.Text = logs.ToString(); }
internal static void FillColumns(TreeNode pTreeNodePadre, Fwk.DataBase.DataEntities.Table pTable) { if (pTable.IsColumnsLoaded) return; Fwk_DataBase.Metadata wMetadata = new Metadata(); wMetadata.Table_FillColumns(pTable); LoadColumnsNodes(pTreeNodePadre, pTable); }
internal static void FillParameters(TreeNode pTreeNodePadre, Fwk.DataBase.DataEntities.StoreProcedure pStoreProcedure) { if (pStoreProcedure.IsParametersLoaded) return; Fwk_DataBase.Metadata wMetadata = new Metadata(); wMetadata.StoreProcedures_FillParameters(pStoreProcedure); LoadParameteresNodes(pTreeNodePadre, pStoreProcedure); }
/// <summary> /// Deserializa un objeto Metadata desde un archivo XML. /// </summary> /// <param name="pszFullPath">Ruta al archivo XML con el objeto Metadata serializado.</param> private void LoadMetaDataFromXml(string pszFullPath) { XmlSerializer oSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Fwk.DataBase.Metadata)); Stream oFileStream = null; try { oFileStream = File.OpenRead(pszFullPath); _Metadata = (Fwk.DataBase.Metadata)oSerializer.Deserialize(oFileStream); this.ConnectionOk = true; IsLoadedMetaDataFromXML = true; this.RefreshMetadata(); } catch (Exception ex) { MessageView.Show(ex); } finally { if (oFileStream != null) oFileStream.Close(); oFileStream = null; oSerializer = null; } }