当前位置: 首页>>代码示例>>C#>>正文


C# ProjectInfo.AddTableInfo方法代码示例

本文整理汇总了C#中ProjectInfo.AddTableInfo方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectInfo.AddTableInfo方法的具体用法?C# ProjectInfo.AddTableInfo怎么用?C# ProjectInfo.AddTableInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectInfo的用法示例。


在下文中一共展示了ProjectInfo.AddTableInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestMethod1


//.........这里部分代码省略.........
            colInfo.SqlType = "Int";
            colInfo.DalType = projectInfo.DBInfoGetter.ToDalType(colInfo.SqlType, colInfo.Precision, colInfo.Scale);
            colInfo.CodeType = projectInfo.CodeInfoGetter.ToCodeType(colInfo.DbType);
            colInfo.MaxLength = 8;
            colInfo.DefaultValue = "((1))";
            colInfo.IsNullable = false;
            colInfo.IsPK = false;
            colInfo.Comment = "Status";
            colInfo.CurrTable = tableInfo;
            colInfo.IsGenSearchCondition = true;
            colInfo.IsGenInput = false;
            colInfo.IsGenSearchResult = true;
            colInfo.IsUnique = false;
            tableInfo.AddColumn(colInfo);

            colInfo = new ColumnInfo();
            colInfo.Name = "Col2";
            colInfo.DbType = DbType.String;
            colInfo.SqlType = "VarChar";
            colInfo.DalType = projectInfo.DBInfoGetter.ToDalType(colInfo.SqlType, colInfo.Precision, colInfo.Scale);
            colInfo.CodeType = projectInfo.CodeInfoGetter.ToCodeType(colInfo.DbType);
            colInfo.MaxLength = 50;
            colInfo.DefaultValue = "22";
            colInfo.IsNullable = true;
            colInfo.IsPK = false;
            colInfo.Comment = "Col2的字段";
            colInfo.CurrTable = tableInfo;
            colInfo.IsGenSearchCondition = true;
            colInfo.IsGenInput = false;
            colInfo.IsGenSearchResult = true;
            colInfo.IsUnique = false;
            tableInfo.AddColumn(colInfo);
            
            projectInfo.AddTableInfo(tableInfo);

            #endregion

            #region Department

            tableInfo = new TableInfo();
            tableInfo.Name = "Department";
            tableInfo.Comment = "部门";

            colInfo = new ColumnInfo();
            colInfo.Name = "Name";
            colInfo.DbType = DbType.String;
            colInfo.SqlType = "VarChar";
            colInfo.DalType = projectInfo.DBInfoGetter.ToDalType(colInfo.SqlType, colInfo.Precision, colInfo.Scale);
            colInfo.CodeType = projectInfo.CodeInfoGetter.ToCodeType(colInfo.DbType);
            colInfo.MaxLength = 100;
            colInfo.IsNullable = false;
            colInfo.Comment = "名称";
            colInfo.CurrTable = tableInfo;
            colInfo.IsGenSearchCondition = true;
            colInfo.IsGenInput = true;
            colInfo.IsGenSearchResult = true;
            colInfo.IsUnique = false;
            tableInfo.AddColumn(colInfo);

            colInfo = new ColumnInfo();
            colInfo.Name = "Code";
            colInfo.DbType = DbType.String;
            colInfo.SqlType = "VarChar";
            colInfo.DalType = projectInfo.DBInfoGetter.ToDalType(colInfo.SqlType, colInfo.Precision, colInfo.Scale);
            colInfo.CodeType = projectInfo.CodeInfoGetter.ToCodeType(colInfo.DbType);
            colInfo.MaxLength = 10;
开发者ID:pmsun-bruce,项目名称:GenCodeTool,代码行数:67,代码来源:GenCodeToolTest.cs

示例2: StartGenBtn_Click

        private void StartGenBtn_Click(object sender, EventArgs e)
        {
            ProjectInfo projectInfo = new ProjectInfo();
            projectInfo.ConnectionString = this.ConnectionStringTxt.Text;
            projectInfo.Name = this.ProjectNameTxt.Text;
            projectInfo.DisplayName = this.ProjectDisplayNameTxt.Text;
            projectInfo.Namespace = this.NamespaceTxt.Text;
            projectInfo.IsClearTargetFolder = this.IsClearTargetFolderChk.Checked;
            projectInfo.ReferenceRootFolder = this.ReferenceFolderTxt.Text;

            if (CodeTemplateCbx.SelectedValue != null)
            {
                projectInfo.TemplatePath = GenCodeHandler.CodeTemplatePool[CodeTemplateCbx.SelectedValue.ToString()];
            }

            projectInfo.GenTargetPath = this.GenTargetFolderTxt.Text;
            projectInfo.DBInfoGetter = (IDBInfoGetter)DBInfoGetterCbx.SelectedItem;
            projectInfo.CodeInfoGetter = (ICodeInfoGetter)CodeInfoGetterCbx.SelectedItem;
            IList<TableInfo> tableInfoList = (IList<TableInfo>)TableInfoBSource.DataSource;
            projectInfo.AllDBTableInfoList = tableInfoList;

            foreach (TableInfo tableInfo in tableInfoList)
            {
                if (!tableInfo.IsGen)
                {
                    continue;
                }

                projectInfo.AddTableInfo(tableInfo);
            }

            string errorMsg = GenCodeHandler.ValidatePreGen(projectInfo);

            if (!string.IsNullOrWhiteSpace(errorMsg))
            {
                MessageBox.Show(GenCodeToolResource.GenFaild + System.Environment.NewLine + errorMsg, GenCodeToolResource.WarningTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ProgressForm progressFrm = new ProgressForm();
            progressFrm.WaitGenProjectInfo = projectInfo;
            progressFrm.ShowDialog();
        }
开发者ID:pmsun-bruce,项目名称:GenCodeTool,代码行数:43,代码来源:MainForm.cs


注:本文中的ProjectInfo.AddTableInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。