Example #1
0
        /// <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.FrameworkConfigGridIntegrateApplicationCli"; // 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);

                result.Add(rowList);
            }

            // FrameworkConfigFieldIntegrate
            {
                var rowList = FrameworkConfigFieldIntegrateFrameworkCli.RowList;

                // Read FrameworkConfigFieldIntegrateCli.List from Application.Cli project.
                string nameCli = "DatabaseIntegrate.dbo.FrameworkConfigFieldIntegrateApplicationCli"; // 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);

                result.Add(rowList);
            }

            // Add application (custom) Integrate data rows to deploy to database
            CommandDeployDbIntegrate(result);
        }
Example #2
0
 /// <summary>
 /// Call method CommandDeployDbIntegrate(); on external AppCli.
 /// </summary>
 public static void CommandDeployDbIntegrate(AppCli appCli, DeployDbIntegrateResult result)
 {
     foreach (var type in appCli.AssemblyApplicationCli.GetTypes())
     {
         if (UtilFramework.IsSubclassOf(type, typeof(AppCli)))
         {
             if (type != appCli.GetType())
             {
                 var appCliExternal = (AppCli)Activator.CreateInstance(type);
                 appCliExternal.CommandDeployDbIntegrate(result);
             }
         }
     }
 }
Example #3
0
        /// <summary>
        /// Populate sql Integrate tables.
        /// </summary>
        private void Integrate()
        {
            var             generateIntegrateResult = AppCli.CommandGenerateIntegrateInternal();
            var             deployDbResult          = new DeployDbIntegrateResult(generateIntegrateResult);
            List <Assembly> assemblyList            = AppCli.AssemblyList(isIncludeApp: true, isIncludeFrameworkCli: true);

            // Populate sql tables FrameworkTable, FrameworkField.
            UtilCli.ConsoleWriteLineColor("Update FrameworkTable, FrameworkField tables", ConsoleColor.Green);
            Meta(deployDbResult);
            UtilDalUpsertIntegrate.UpsertAsync(deployDbResult.Result, assemblyList).Wait();

            // Populate sql Integrate tables.
            UtilCli.ConsoleWriteLineColor("Update Integrate tables", ConsoleColor.Green);
            AppCli.CommandDeployDbIntegrateInternal(deployDbResult);
            UtilDalUpsertIntegrate.UpsertAsync(deployDbResult.Result, assemblyList).Wait();
        }
Example #4
0
        /// <summary>
        /// Populate sql tables FrameworkTable, FrameworkField with assembly typeRow.
        /// </summary>
        private void Meta(DeployDbIntegrateResult result)
        {
            var         assemblyList = AppCli.AssemblyList(isIncludeApp: true);
            List <Type> typeRowList  = UtilDalType.TypeRowList(assemblyList);
            // Table
            {
                List <FrameworkTable> rowList = new List <FrameworkTable>();
                foreach (Type typeRow in typeRowList)
                {
                    FrameworkTable table = new FrameworkTable();
                    rowList.Add(table);
                    table.TableNameCSharp = UtilDalType.TypeRowToTableNameCSharp(typeRow);
                    if (UtilDalType.TypeRowIsTableNameSql(typeRow))
                    {
                        table.TableNameSql = UtilDalType.TypeRowToTableNameWithSchemaSql(typeRow);
                    }
                    table.IsDelete = false;
                }
                result.Add(rowList);
            }

            // Field
            {
                List <FrameworkFieldIntegrate> rowList = new List <FrameworkFieldIntegrate>();
                foreach (Type typeRow in typeRowList)
                {
                    string tableNameCSharp = UtilDalType.TypeRowToTableNameCSharp(typeRow);
                    var    fieldList       = UtilDalType.TypeRowToFieldList(typeRow);
                    foreach (var field in fieldList)
                    {
                        FrameworkFieldIntegrate fieldIntegrate = new FrameworkFieldIntegrate();
                        rowList.Add(fieldIntegrate);

                        fieldIntegrate.TableIdName     = tableNameCSharp;
                        fieldIntegrate.FieldNameCSharp = field.PropertyInfo.Name;
                        fieldIntegrate.FieldNameSql    = field.FieldNameSql;
                        fieldIntegrate.Sort            = field.Sort;
                        fieldIntegrate.IsDelete        = false;
                    }
                }

                rowList = rowList.OrderBy(item => item.TableIdName).ThenBy(item => item.FieldNameCSharp).ToList();

                result.Add(rowList);
            }
        }
Example #5
0
        /// <summary>
        /// Populate sql Integrate tables.
        /// </summary>
        private void Integrate(int?reseed)
        {
            var             generateIntegrateResult = AppCli.CommandGenerateIntegrateInternal(isDeployDb: true, null);
            var             deployDbResult          = new DeployDbIntegrateResult(generateIntegrateResult);
            List <Assembly> assemblyList            = AppCli.AssemblyList(isIncludeApp: true, isIncludeFrameworkCli: true);

            // Populate sql tables FrameworkTable, FrameworkField.
            UtilCli.ConsoleWriteLineColor("Update FrameworkTable, FrameworkField tables", ConsoleColor.Green);
            Meta(deployDbResult);
            IntegrateReseed(deployDbResult.Result, reseed, assemblyList);
            UtilDalUpsertIntegrate.UpsertAsync(deployDbResult.Result, assemblyList).Wait();

            // Populate sql Integrate tables.
            UtilCli.ConsoleWriteLineColor("Update Integrate tables ", ConsoleColor.Green, isLine: false);
            AppCli.CommandDeployDbIntegrateInternal(deployDbResult);
            IntegrateReseed(deployDbResult.Result, reseed, assemblyList);
            UtilDalUpsertIntegrate.UpsertAsync(deployDbResult.Result, assemblyList, (typeRow) => UtilCli.ConsoleWriteLineColor(".", ConsoleColor.Green, isLine: false)).Wait(); // See also property IsDeploy
            Console.WriteLine();
        }
Example #6
0
        /// <summary>
        /// Cli deployDb command.
        /// </summary>
        protected override void CommandDeployDbIntegrate(DeployDbIntegrateResult result)
        {
            // Navigate
            var rowList = NavigateIntegrateAppCli.RowList;

            result.Add(rowList, (item) => item.IdName, (item) => item.ParentIdName, (item) => item.Sort);

            // LoginUser
            result.Add(LoginUserIntegrateApp.RowList);
            result.Add(LoginRoleIntegrateApp.RowList);
            result.Add(LoginUserRoleIntegrateAppCli.RowList);

            // NavigateLoginRole
            result.Add(NavigateRoleIntegrateAppCli.RowList);

            // StorageFile
            result.Add(StorageFileIntegrateAppCli.RowList);

            // Content
            result.Add(ContentIntegrateAppCli.RowList);

            // Feedback
            result.Add(FeedbackAppCli.RowList);
        }
Example #7
0
 /// <summary>
 /// Override this method to add Integrate data rows to list. Used by cli deployDb command to deploy Integrate rows to database.
 /// </summary>
 protected virtual internal void CommandDeployDbIntegrate(DeployDbIntegrateResult result)
 {
 }