本文整理汇总了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;
示例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();
}