/// <summary> /// Returns ExternalArgs. /// </summary> public static ExternalArgs ExternalArgs() { // ExternalGit/ProjectName/ string externalGitProjectNamePath = "ExternalGit/" + UtilExternal.ExternalProjectName() + "/"; // Application/App/ string appSourceFolderName = UtilFramework.FolderName + "Application/App/"; string appDestFolderName = UtilExternal.FolderNameExternal + "Application/App/" + externalGitProjectNamePath; // Application.Database/Database/ string databaseSourceFolderName = UtilFramework.FolderName + "Application.Database/Database/"; string databaseDestFolderName = UtilExternal.FolderNameExternal + "Application.Database/Database/" + externalGitProjectNamePath; // Application.Website/ string websiteSourceFolderName = UtilFramework.FolderName + "Application.Website/"; string websiteDestFolderName = UtilExternal.FolderNameExternal + "Application.Website/" + externalGitProjectNamePath; // Application.Cli/App/ string cliAppSourceFolderName = UtilFramework.FolderName + "Application.Cli/App/"; string cliAppDestFolderName = UtilExternal.FolderNameExternal + "Application.Cli/App/" + externalGitProjectNamePath; // Application.Cli/App/ string cliDatabaseSourceFolderName = UtilFramework.FolderName + "Application.Cli/Database/"; string cliDatabaseDestFolderName = UtilExternal.FolderNameExternal + "Application.Cli/Database/" + externalGitProjectNamePath; // Application.Cli/DeployDb/ string cliDeployDbSourceFolderName = UtilFramework.FolderName + "Application.Cli/DeployDb/"; string cliDeployDbDestFolderName = UtilExternal.FolderNameExternal + "Application.Cli/DeployDb/" + externalGitProjectNamePath; // Angular string websiteAngularDestFolderName = UtilExternal.FolderNameExternal + "Framework/Framework.Angular/application/src/Application.Website/"; var result = new ExternalArgs { AppSourceFolderName = appSourceFolderName, AppDestFolderName = appDestFolderName, DatabaseSourceFolderName = databaseSourceFolderName, DatabaseDestFolderName = databaseDestFolderName, WebsiteSourceFolderName = websiteSourceFolderName, WebsiteDestFolderName = websiteDestFolderName, CliAppSourceFolderName = cliAppSourceFolderName, CliAppDestFolderName = cliAppDestFolderName, CliDatabaseSourceFolderName = cliDatabaseSourceFolderName, CliDatabaseDestFolderName = cliDatabaseDestFolderName, CliDeployDbSourceFolderName = cliDeployDbSourceFolderName, CliDeployDbDestFolderName = cliDeployDbDestFolderName, WebsiteAngularDestFolderName = websiteAngularDestFolderName, ExternalProjectName = UtilExternal.ExternalProjectName(), }; return(result); }
/// <summary> /// Returns Integrate rows to deploy to sql database. /// </summary> internal void CommandDeployDbIntegrateInternal(DeployDbIntegrateResult result) { // FrameworkConfigGridIntegrate { var rowList = FrameworkConfigGridIntegrateFrameworkCli.RowList; // Read FrameworkConfigGridIntegrate.RowListList from Application.Cli project. string nameCli = "DatabaseIntegrate.dbo.FrameworkConfigGridIntegrateAppCli"; // See also method GenerateCSharpTableNameClass(); var typeCli = AssemblyApplicationCli.GetType(nameCli); UtilFramework.Assert(typeCli != null, string.Format("Type not found! See also method GenerateCSharpTableNameClass(); ({0})", nameCli)); PropertyInfo propertyInfo = typeCli.GetProperty(nameof(FrameworkConfigGridIntegrateFrameworkCli.RowList)); var rowApplicationCliList = (List <FrameworkConfigGridIntegrate>)propertyInfo.GetValue(null); rowList.AddRange(rowApplicationCliList); // Collect rowList from external FrameworkConfigGridIntegrateAppCli (ConfigGrid). UtilExternal.CommandDeployDbIntegrate(this, rowList); result.Add(rowList); } // FrameworkConfigFieldIntegrate { var rowList = FrameworkConfigFieldIntegrateFrameworkCli.RowList; // Read FrameworkConfigFieldIntegrateCli.List from Application.Cli project. string nameCli = "DatabaseIntegrate.dbo.FrameworkConfigFieldIntegrateAppCli"; // See also method GenerateCSharpTableNameClass(); var typeCli = AssemblyApplicationCli.GetType(nameCli); UtilFramework.Assert(typeCli != null, string.Format("Type not found! See also method GenerateCSharpTableNameClass(); ({0})", nameCli)); PropertyInfo propertyInfo = typeCli.GetProperty(nameof(FrameworkConfigFieldIntegrateFrameworkCli.RowList)); var rowApplicationCliList = (List <FrameworkConfigFieldIntegrate>)propertyInfo.GetValue(null); rowList.AddRange(rowApplicationCliList); // Collect rowList from external FrameworkConfigFieldIntegrateAppCli (ConfigField). UtilExternal.CommandDeployDbIntegrate(this, rowList); result.Add(rowList); } // Add application (custom) Integrate data rows to deploy to database CommandDeployDbIntegrate(result); // Call method CommandDeployDbIntegrate(); on external AppCli. UtilExternal.CommandDeployDbIntegrate(this, result); }
/// <summary> /// Returns Integrate rows to generate CSharp code. /// </summary> /// <param name="isDeployDb">Method is called from command cli generate or cli deployDb.</param> /// <param name="tableNameCSharpApplicationFilterList">TableNameCSharp defined in method AppCli.CommandGenerateFilter();</param> internal GenerateIntegrateResult CommandGenerateIntegrateInternal(bool isDeployDb, List <string> tableNameCSharpApplicationFilterList) { var result = new GenerateIntegrateResult(AssemblyList(true, true)); result.AddKey <FrameworkTable>(nameof(FrameworkTable.TableNameCSharp)); // Do not generate CSharp code for table FrameworkTable and FrameworkField. Add reference for deoplyDb. result.AddKey <FrameworkField>(nameof(FrameworkField.TableId), nameof(FrameworkField.FieldNameCSharp)); result.AddReference <FrameworkField, FrameworkTable>(nameof(FrameworkFieldIntegrate.TableId)); var tableNameCSharpFrameworkList = UtilDalType.TableNameCSharpList(AssemblyFramework); // TableNameCSharp declared in Framework assembly. var tableNameCSharpApplicationList = UtilDalType.TableNameCSharpList(AssemblyApplication, AssemblyApplicationDatabase); // TableNameCSharp declared in Application assembly. var fieldNameCSharpFrameworkList = UtilDalType.FieldNameCSharpList(AssemblyFramework); // FieldNameCSharp declared in Framework assembly var fieldNameCSharpApplicationList = UtilDalType.FieldNameCSharpList(AssemblyApplication, AssemblyApplicationDatabase); // FieldNameCSharp declared in Framework assembly // Filter out tables defined in method AppCli.CommandGenerateFilter(); if (tableNameCSharpApplicationFilterList != null) { tableNameCSharpApplicationList = tableNameCSharpApplicationList.Where(item => tableNameCSharpApplicationFilterList.Contains(item.Value)).ToDictionary(item => item.Key, item => item.Value); fieldNameCSharpApplicationList = fieldNameCSharpApplicationList.Where(item => tableNameCSharpApplicationFilterList.Contains(item.TableNameCSharp)).ToList(); } // Prevent build error "An expression tree may not contain a tuple literal". var fieldNameCSharpFrameworkNoTupleList = fieldNameCSharpFrameworkList.Select(item => item.TableNameCSharp + "/" + item.FieldNameCSharp); var fieldNameCSharpApplicationNoTupleList = fieldNameCSharpApplicationList.Select(item => item.TableNameCSharp + "/" + item.FieldNameCSharp); // FrameworkConfigGridIntegrate { var rowList = Data.Query <FrameworkConfigGridIntegrate>(); // Framework (.\cli.cmd generate -f) { var rowFilterList = rowList.Where(item => tableNameCSharpFrameworkList.Values.ToArray().Contains(item.TableNameCSharp)); // Filter Framework. rowFilterList = rowFilterList.OrderBy(item => item.IdName); result.Add( isFrameworkDb: true, isApplication: false, typeRow: typeof(FrameworkConfigGridIntegrate), query: rowFilterList ); } // Application (.\cli.cmd generate) { var rowFilterList = rowList.Where(item => !tableNameCSharpFrameworkList.Values.ToArray().Contains(item.TableNameCSharp) && tableNameCSharpApplicationList.Values.ToArray().Contains(item.TableNameCSharp)); // Filter (not Framework and Application). rowFilterList = rowFilterList.OrderBy(item => item.IdName); result.Add( isFrameworkDb: false, isApplication: false, typeRow: typeof(FrameworkConfigGridIntegrate), query: rowFilterList ); } result.AddKey <FrameworkConfigGrid>(nameof(FrameworkConfigGrid.TableId), nameof(FrameworkConfigGrid.ConfigName)); result.AddReference <FrameworkConfigGrid, FrameworkTable>(nameof(FrameworkConfigGrid.TableId)); } // FrameworkConfigFieldIntegrate { var rowList = Data.Query <FrameworkConfigFieldIntegrate>(); // Framework (.\cli.cmd generate -f) { var rowFilterList = rowList.Where(item => tableNameCSharpFrameworkList.Values.ToArray().Contains(item.TableNameCSharp)); // Filter FrameworkDb. rowFilterList = rowList.Where(item => fieldNameCSharpFrameworkNoTupleList.Contains(item.TableNameCSharp + "/" + item.FieldNameCSharp)); // Filter FieldNameCSharp declared in Framework assembly. rowFilterList = rowFilterList.OrderBy(item => item.FieldIdName); result.Add( isFrameworkDb: true, isApplication: false, typeRow: typeof(FrameworkConfigFieldIntegrate), query: rowFilterList ); } // Application (.\cli.cmd generate) { var rowFilterList = rowList.Where(item => !tableNameCSharpFrameworkList.Values.ToArray().Contains(item.TableNameCSharp) && tableNameCSharpApplicationList.Values.ToArray().Contains(item.TableNameCSharp)); // Filter (not Framework and Application). rowFilterList = rowList.Where(item => fieldNameCSharpApplicationNoTupleList.Contains(item.TableNameCSharp + "/" + item.FieldNameCSharp)); // Filter FieldNameCSharp declared in Application assembly. rowFilterList = rowFilterList.OrderBy(item => item.FieldIdName); result.Add( isFrameworkDb: false, isApplication: false, typeRow: typeof(FrameworkConfigFieldIntegrate), query: rowFilterList ); } result.AddKey <FrameworkConfigField>(nameof(FrameworkConfigField.ConfigGridId), nameof(FrameworkConfigField.FieldId), nameof(FrameworkConfigField.InstanceName)); result.AddReference <FrameworkConfigField, FrameworkConfigGrid>(nameof(FrameworkConfigField.ConfigGridId)); result.AddReference <FrameworkConfigField, FrameworkField>(nameof(FrameworkConfigField.FieldId)); } // Application (custom) Integrate data rows to generate CSharp code from. CommandGenerateIntegrate(result); // Call method CommandGenerateIntegrate(); on external AppCli for deployDb only. Not for cli generate command. if (isDeployDb) { UtilExternal.CommandGenerateIntegrate(this, result); } return(result); }