ExecuteTSC() public static method

public static ExecuteTSC ( string workingDirectory, string arguments ) : void
workingDirectory string
arguments string
return void
コード例 #1
0
        public void Run()
        {
            if (!scriptPath.IsEmptyOrNull())
            {
                Directory.CreateDirectory(scriptPath);
            }

            Directory.CreateDirectory(siteWebPath);

            GenerateRow();
            GenerateCss();
            GenerateColumns();
            GenerateForm();
            GenerateRepository();
            GenerateEndpoint();
            GeneratePageController();
            GeneratePageIndex();

            if (config.GenerateSSImports && scriptProject != null)
            {
                GenerateScriptRowSS();
                GenerateScriptServiceSS();
                GenerateScriptFormSS();
            }

            if (config.GenerateTSTypings)
            {
                GenerateScriptRowTS();
                GenerateScriptServiceTS();
                GenerateScriptFormTS();
            }

            if (config.GenerateTSCode)
            {
                GenerateScriptGridTS();
                GenerateScriptDialogTS();
            }
            else if (scriptProject != null)
            {
                GenerateScriptGridSS();
                GenerateScriptDialogSS();
            }

            if (config.GenerateTSCode ||
                config.GenerateTSTypings)
            {
                CodeFileHelper.ExecuteTSC(Path.Combine(siteWebPath, @"Scripts\"), "");
            }
        }
コード例 #2
0
        private void GenerateCodes_Click(object sender, RoutedEventArgs e)
        {
            var conn = (GeneratorConfig.Connection) this.ConnectionsCombo.SelectedItem;

            if (conn == null)
            {
                MessageBox.Show("A connection must be selected!");
                return;
            }

            var tables = this._tables.Where(x => x.IsChecked == true);

            if (this.ConnectionsCombo.SelectedItem == null)
            {
                MessageBox.Show("Please select at least one table!");
                return;
            }
            ;

            var noIdentifier = tables.FirstOrDefault(x => x.Identifier.IsTrimmedEmpty());

            if (noIdentifier != null)
            {
                MessageBox.Show("Identifier for table " + noIdentifier.FullName + " is empty!");
                return;
            }
            ;

            foreach (var table in tables)
            {
                try
                {
                    EntityModel rowModel;

                    using (var connection = SqlConnections.New(conn.ConnectionString, conn.ProviderName))
                    {
                        connection.Open();
                        var    tableName = table.FullName;
                        string schema    = null;
                        if (tableName.IndexOf('.') > 0)
                        {
                            schema    = tableName.Substring(0, tableName.IndexOf('.'));
                            tableName = tableName.Substring(tableName.IndexOf('.') + 1);
                        }

                        rowModel = RowGenerator.GenerateModel(connection, schema, tableName,
                                                              table.Module, table.ConnectionKey, table.Identifier, table.PermissionKey, config);

                        var kdiff3Paths = new[]
                        {
                            config.KDiff3Path,
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "KDiff3\\kdiff3.exe"),
                            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "KDiff3\\kdiff3.exe"),
                        };

                        CodeFileHelper.Kdiff3Path = kdiff3Paths.FirstOrDefault(File.Exists);

                        if (config.TFSIntegration)
                        {
                            CodeFileHelper.SetupTFSIntegration(config.TFPath);
                        }

                        CodeFileHelper.SetupTSCPath(config.TSCPath);
                        var siteWebProj = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.WebProjectFile));

                        new EntityCodeGenerator(rowModel, config, siteWebProj).Run();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            if (config.GenerateService ||
                config.GenerateUI ||
                config.GenerateCustom)
            {
                var siteWebProj = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.WebProjectFile));
                var siteWebPath = Path.GetDirectoryName(siteWebProj);
                CodeFileHelper.ExecuteTSC(Path.Combine(siteWebPath, @"Scripts\"), "");
            }

            MessageBox.Show("Code files for the selected table is generated. Please REBUILD SOLUTION before running application, otherwise you may have script errors!");
            GenerateCodeButton.IsEnabled = false;
        }