예제 #1
0
        /// <summary>
        /// Call method CommandGenerateFilter();
        /// </summary>
        private static void Run(ref MetaSqlSchema[] list, ref List <Type> typeRowCalculatedList, AppCli appCli)
        {
            var args   = new GenerateFilterArgs(list);
            var result = new GenerateFilterResult();

            // Args for calculated row
            var         assemblyList = appCli.AssemblyList(isIncludeApp: true);
            List <Type> typeRowList  = UtilDalType.TypeRowList(assemblyList);

            foreach (Type typeRow in typeRowList)
            {
                if (UtilDalType.TypeRowIsTableNameSql(typeRow) == false) // Calculated row
                {
                    args.TypeRowCalculatedList.Add(typeRow);
                }
            }

            // Call method CommandGenerateFilter();
            appCli.CommandGenerateFilter(args, result);

            // Result
            if (result.FieldSqlList != null)
            {
                list = result.List;
            }
            if (result.TypeRowCalculatedList == null)
            {
                typeRowCalculatedList = args.TypeRowCalculatedList;
            }
            else
            {
                typeRowCalculatedList = result.TypeRowCalculatedList;
            }
        }
예제 #2
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();
        }
예제 #3
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);
            }
        }
예제 #4
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();
        }