本文整理汇总了C#中Table.GetColumnsFullHierarchy方法的典型用法代码示例。如果您正苦于以下问题:C# Table.GetColumnsFullHierarchy方法的具体用法?C# Table.GetColumnsFullHierarchy怎么用?C# Table.GetColumnsFullHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.GetColumnsFullHierarchy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBody
public static string GetBody(Table table, ModelRoot model)
{
try
{
List<Column> allColumns = new List<Column>();
foreach (Column dc in table.GetColumnsFullHierarchy())
{
if (!(dc.DataType == System.Data.SqlDbType.Binary ||
dc.DataType == System.Data.SqlDbType.Image ||
dc.DataType == System.Data.SqlDbType.NText ||
dc.DataType == System.Data.SqlDbType.Text ||
dc.DataType == System.Data.SqlDbType.Timestamp ||
dc.DataType == System.Data.SqlDbType.Udt ||
dc.DataType == System.Data.SqlDbType.VarBinary ||
dc.DataType == System.Data.SqlDbType.Variant ||
dc.DataType == System.Data.SqlDbType.Money))
{
allColumns.Add(dc);
}
}
if (allColumns.Count != 0)
{
return BuildStoredProcedure(table, model, allColumns);
}
return "";
}
catch (Exception ex)
{
throw new Exception(table.DatabaseName + ": Failed on generation of paging select statement", ex);
}
}
示例2: BuildParameterList
private static string BuildParameterList(Table table, ModelRoot model)
{
ArrayList items = new ArrayList();
List<Column> columnList = new List<Column>();
foreach (Column c in table.GetColumnsFullHierarchy())
columnList.Add(c);
for (int ii = 0; ii < columnList.Count; ii++)
{
Column dc = columnList[ii];
//if (dc.Identity != IdentityTypeConstants.Database)
items.Add(columnList[ii]);
}
StringBuilder output = new StringBuilder();
for (int ii = 0; ii < items.Count; ii++)
{
Column dc = (Column)(items[ii]);
output.Append(" @" + ValidationHelper.MakeDatabaseScriptIdentifier(dc.DatabaseName) + " " + dc.GetSQLDefaultType() + " = default");
if (ii < items.Count - 1 || (table.AllowCreateAudit) || (table.AllowModifiedAudit))
output.Append(",");
output.AppendLine();
}
if (table.AllowCreateAudit)
{
//Create Date
output.AppendFormat(" @{0} datetime", model.Database.CreatedDateColumnName);
output.Append(",");
output.AppendLine();
//Create By
output.AppendFormat(" @{0} varchar (50)", model.Database.CreatedByColumnName);
if (table.AllowModifiedAudit)
output.Append(",");
output.AppendLine();
}
if (table.AllowModifiedAudit)
{
//Modified By
output.AppendFormat(" @{0} varchar (50)", model.Database.ModifiedByColumnName);
output.AppendLine();
}
return output.ToString();
}
示例3: BuildSelectList
public static string BuildSelectList(Table table, ModelRoot model, bool useFullHierarchy)
{
int index = 0;
StringBuilder output = new StringBuilder();
List<Column> columnList = new List<Column>();
if (useFullHierarchy)
{
foreach (Column c in table.GetColumnsFullHierarchy())
columnList.Add(c);
}
else
{
foreach (Reference r in table.GeneratedColumns)
columnList.Add((Column)r.Object);
}
foreach (Column dc in columnList)
{
Table parentTable = (Table)dc.ParentTableRef.Object;
output.AppendFormat(" [{0}].[{1}]", GetTableDatabaseName(model, parentTable), dc.DatabaseName.ToLower());
if ((index < columnList.Count - 1) || (table.AllowCreateAudit) || (table.AllowModifiedAudit) || (table.AllowTimestamp))
output.Append(",");
output.AppendLine();
index++;
}
if (table.AllowCreateAudit)
{
output.AppendFormat(" [{0}].[{1}],", GetTableDatabaseName(model, table), model.Database.CreatedByColumnName);
output.AppendLine();
output.AppendFormat(" [{0}].[{1}]", GetTableDatabaseName(model, table), model.Database.CreatedDateColumnName);
if ((table.AllowModifiedAudit) || (table.AllowTimestamp))
output.Append(",");
output.AppendLine();
}
if (table.AllowModifiedAudit)
{
output.AppendFormat(" [{0}].[{1}],", GetTableDatabaseName(model, table), model.Database.ModifiedByColumnName);
output.AppendLine();
output.AppendFormat(" [{0}].[{1}]", GetTableDatabaseName(model, table), model.Database.ModifiedDateColumnName);
if (table.AllowTimestamp)
output.Append(",");
output.AppendLine();
}
if (table.AllowTimestamp)
{
output.AppendFormat(" [{0}].[{1}]", GetTableDatabaseName(model, table), model.Database.TimestampColumnName);
output.AppendLine();
}
return output.ToString();
}