Example #1
0
        /// <summary>
        ///     The save.
        /// </summary>
        public void Save()
        {
            ITableHierarchyService applicationService = new TempateHierarchyService();

            List <Table> addTables       = applicationService.ReturnTables(this.TreeViewAdd.Nodes[0]);
            List <Table> removeTables    = applicationService.ReturnTables(this.TreeViewDelete.Nodes[0]);
            List <Table> refreshedTables = applicationService.ReturnTables(this.TreeViewRefresh.Nodes[0]);

            if (addTables.Count > 0 || removeTables.Count > 0 || refreshedTables.Count > 0)
            {
                List <Table> newTables = applicationService.DoTableCollectionDiff(
                    this.DataSource.Tables,
                    addTables,
                    removeTables,
                    refreshedTables,
                    this.differences);

                this.sourceType.Fix(newTables);
                this.DataSource.Tables = newTables;
            }


            this.sourceType.Fix(this.DataSource.Tables);
        }
Example #2
0
        /// <summary>
        ///     The update Application Service.
        /// </summary>
        private void UpdateApplicationService()
        {
            if (SelectedApplicationService == null)
            {
                return;
            }

            SelectedApplicationService.OutputFolder           = OutputFolder.Text;
            SelectedApplicationService.Namespace              = Namespace.Text;
            SelectedApplicationService.ApplicationServiceName = ApplicationServiceName.Text;
            SelectedApplicationService.InheritFrom            = InheritFrom.Text;
            SelectedApplicationService.OutputPath             = OutputPath.Text;
            SelectedApplicationService.Models.Clear();

            SelectedApplicationService.OutputFolderInterface = OutputFolderInterface.Text;
            SelectedApplicationService.NamespaceInterface    = NamespaceInterface.Text;
            SelectedApplicationService.InheritFromInterface  = InheritFromInterface.Text;
            SelectedApplicationService.OutputPathInterface   = OutputPathInterface.Text;

            if (TreeviewContextModels.Nodes.Count > 0)
            {
                ITableHierarchyService applicationService = new TempateHierarchyService();

                var tables = applicationService.ReturnTables(TreeviewContextModels.Nodes[0]);
                if (tables != null && tables.Any())
                {
                    foreach (var table in tables)
                    {
                        SelectedApplicationService.Models.Add(new Table
                        {
                            TableName  = table.TableName,
                            SchemaName = table.SchemaName,
                            EnabledForCodeGeneration = table.EnabledForCodeGeneration,
                            Columns = table.Columns
                        });
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        ///     The update context.
        /// </summary>
        private void UpdateContext()
        {
            if (SelectedContext == null)
            {
                return;
            }

            SelectedContext.OutputFolder         = OutputFolder.Text;
            SelectedContext.Namespace            = Namespace.Text;
            SelectedContext.ContextName          = ContextName.Text;
            SelectedContext.InheritFrom          = InheritFromInterface.Text;
            SelectedContext.CustomConnectionName = txtCustomConnectionName.Text;
            SelectedContext.OutputPath           = OutputPath.Text;
            SelectedContext.IsDefault            =
                chkIsDefault.Checked || !(DataType as ContextDataType).Contexts.Any(o => o.IsDefault);

            SelectedContext.Models.Clear();

            if (TreeviewContextModels.Nodes.Count > 0)
            {
                ITableHierarchyService applicationService = new TempateHierarchyService();

                var tables = applicationService.ReturnTables(TreeviewContextModels.Nodes[0]);
                if (tables != null && tables.Any())
                {
                    foreach (var table in tables)
                    {
                        SelectedContext.Models.Add(new Table
                        {
                            TableName  = table.TableName,
                            SchemaName = table.SchemaName,
                            EnabledForCodeGeneration = table.EnabledForCodeGeneration
                        });
                    }
                }
            }
        }