Example #1
0
		private void AddNCodeGenCommand_Click(object sender, EventArgs e) {
			CodeGeneratorCommand command = new CodeGeneratorCommand();
			_project.GeneratorCommands.Add(command);
			RefreshUI();
			IObjectEditor editor = new CodeGeneratorCommandEditor(command);
			editor.SelectedObjectChanged += new EventHandler(IObjectEditor_SelectedObjectChanged);
			ObjectEditorManager.OpenObjectEditor(editor);
		}
Example #2
0
		private void Test_CodeGeneratorCommand() {
			try {
				Trace.WriteLine("Create a new project and generate using OREntity...");
				Trace.Indent();
				Project p = new Project();
				p.Save(".\\test\\output\\test_ncodegencommandproject_01.ch3");
				p.MetadataBaseDir = "..\\";
				p.TemplatePackageBaseDir = "..\\";
				p.OutputBaseDir = "..\\Output";
				MetadataFile mf = new MetadataFile(p, "UsuarioInformatica.xml");
				p.MetadataFiles.Add(mf);
				CodeGeneratorCommand gc = new CodeGeneratorCommand();
				p.GeneratorCommands.Add(gc);
				gc.IndividualMetadataFiles.Add(p.MetadataFiles[0]);
				gc.Package = "TEST_NCODEGEN_PACKAGE";
				gc.Template = "SPs_CRUD_Object";
				p.GeneratorCommands.Add(gc);
				gc.InputParameters.Add("FileNamePartial", "NCodeGen_Output_01");
				gc.OutputPath = "test_${FileNamePartial}.sql";
				p.Save();
				gc.Execute();
				// UNDONE: need to test whether files were outputted correctly

				Trace.Unindent();
			}
			catch (Exception ex) {
				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
			}

		}
Example #3
0
//		private void Test_MetadataFiles() {
//			try {
//				Trace.WriteLine("Create a new, non-branded metadata file and save...");
//				Trace.Indent();
//				MetadataFile f = new MetadataFile();
//				f.MetadataEntities.Add(new XmlMetadataEntity());
//				XmlMetadataEntity en = (XmlMetadataEntity) f.MetadataEntities[0];
//				en.XmlNode = (new XmlDocument()).CreateElement("Books");
//				en.XmlNode.InnerXml = "<book price=\"100.00\"/>";
//				f.Save(".\\test\\output\\test_create.xml");
//				Trace.Unindent();
//			}
//			catch (Exception ex) {
//				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
//			}
//
//			try {
//				Trace.WriteLine("Load a non-branded metadata file and save as...");
//				Trace.Indent();
//				MetadataFile f = new MetadataFile(null, ".\\test\\output\\test_create.xml");
//				f.Save(".\\test\\output\\test_loadsaveas.xml");
//
//				// UNDONE: need to test whether files are identical
//
//				Trace.Unindent();
//			}
//			catch (Exception ex) {
//				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
//			}
//
//			try {
//				Trace.WriteLine("Load plain XML file and save as....");
//				Trace.Indent();
//				MetadataFile f = new MetadataFile(null, ".\\test\\raw.xml");
//				f.Save(".\\test\\output\\test_rawsaveas.xml");
//
//				// UNDONE: need to test whether files are identical
//				// this can be a seperate method which takes source and dest file names
//
//				Trace.Unindent();
//			}
//			catch (Exception ex) {
//				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
//			}
//
//
//			// Create branded metadata file and save
//
//			// Load a branded metadata file and save as
//
//			// Create mixed (branded/not branded) metadata file and save
//
//			// Load a mixed (branded/not branded) metadata file and save as
//
//		}
//

		#endregion Metadata Files

		#region Project

		private void Test_Project() {
			try {
				Trace.WriteLine("Create a new project and save...");
				Trace.Indent();
				Project p = new Project();
				p.Save(".\\test\\output\\test_projectcreate.ch3");
				p.MetadataBaseDir = "..\\";
				MetadataFile mf = new MetadataFile(p, "raw.xml");
				p.MetadataFiles.Add(mf);
				CodeGeneratorCommand gc = new CodeGeneratorCommand();
				p.GeneratorCommands.Add(gc);
				gc.IndividualMetadataFiles.Add(p.MetadataFiles[0]);
// 				gc.GroupedMetadataFiles.Add(p.MetadataFiles[0]);
				gc.Package = "CSLA";
				gc.Template = "SP_S_Object_By_Index";
				p.Save();
				Trace.Unindent();
			}
			catch (Exception ex) {
				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
			}

			try {
				Trace.WriteLine("Load project file and save as...");
				Trace.Indent();
				Project p = Project.Load(".\\test\\output\\test_projectcreate.ch3");
				p.Save(".\\test\\output\\test_projectsaveas.ch3");

				// UNDONE: need to test whether files are identical

				Trace.Unindent();
			}
			catch (Exception ex) {
				Trace.WriteLine("\r\n" + ex.ToString() + "\r\n");
			}
		}
		public CodeGenerationTemplateEditor(CodeGeneratorCommand generatorCommand) : this() {
			SelectedObject = generatorCommand;
		}
Example #5
0
		private void AddNCodeGenCommand_Click(object sender, EventArgs e) {
			CodeGeneratorCommand command = new CodeGeneratorCommand();
			_project.GeneratorCommands.Add(command);
			RefreshUI();
			OpenObjectEditor(command);
		}
		public CodeGeneratorCommandEditor(CodeGeneratorCommand generatorCommand) : this() {
			_generatorCommand = generatorCommand;
		}