本文整理汇总了C#中Dialect.GetColumnComment方法的典型用法代码示例。如果您正苦于以下问题:C# Dialect.GetColumnComment方法的具体用法?C# Dialect.GetColumnComment怎么用?C# Dialect.GetColumnComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialect
的用法示例。
在下文中一共展示了Dialect.GetColumnComment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToSqlCreate
/// <summary>
/// Generates SQL for creating this table.
/// </summary>
/// <param name="dialect"></param>
/// <param name="defaultCatalog">the default catalog name</param>
/// <param name="defaultSchema">the default schema name</param>
/// <returns>an SQL string</returns>
public String ToSqlCreate(Dialect dialect, String defaultCatalog, String defaultSchema)
{
StringBuilder sb = StringHelper.CreateBuilder()
.Append(HasPrimaryKey ? dialect.CreateTableString : dialect.CreateMultisetTableString)
.Append(" ")
.Append(GetQualifiedName(dialect, defaultCatalog, defaultSchema))
.Append(" (");
Boolean hasIdentity = false;
StringHelper.AppendItemsWithComma(Columns, delegate(Column column)
{
// column info
sb.Append(column.GetQuotedName(dialect))
.Append(" ");
if (column.DbType == DbType.Identity)
{
hasIdentity = true;
if (dialect.HasDataTypeInIdentityColumn)
sb.Append(column.GetSqlType(dialect));
sb.Append(" ").Append(dialect.IdentityColumnString);
}
else
{
sb.Append(column.GetSqlType(dialect));
if (column.DefaultValue != null)
sb.Append(" DEFAULT ").Append(column.DefaultValue);
if (column.Nullable)
sb.Append(dialect.NullColumnString);
else
sb.Append(" NOT NULL");
}
// unique constraint
if (column.Unique &&
(!column.Nullable || dialect.SupportsNullableUnique))
{
if (dialect.SupportsUnique)
sb.Append(" UNIQUE");
else
{
UniqueKey uk = GetOrCreateUniqueKey(column.GetQuotedName(dialect) + "_");
uk.AddColumn(column);
}
}
// check constraint
if (column.CheckConstraint != null && dialect.SupportsColumnCheck)
sb.Append(" CHECK (")
.Append(column.CheckConstraint)
.Append(")");
// comment
if (column.Comment != null)
sb.Append(dialect.GetColumnComment(column.Comment));
}, sb);
if (HasPrimaryKey && !(hasIdentity && dialect.HasPrimaryKeyInIdentityColumn))
sb.Append(", ")
.Append(PrimaryKey.ToSqlConstraintString(dialect));
if (dialect.SupportsUniqueConstraintInCreateAlterTable)
{
foreach (UniqueKey uk in _uniqueKeys.Values)
{
String constraint = uk.ToSqlConstraintString(dialect);
if (!String.IsNullOrEmpty(constraint))
sb.Append(", ").Append(constraint);
}
}
// table check
if (dialect.SupportsTableCheck)
{
foreach (String check in _checkConstraints)
{
sb.Append(", CHECK (").Append(check).Append(")");
}
}
sb.Append(")");
if (Comment != null)
{
sb.Append(dialect.GetTableComment(Comment));
}
return sb.ToString();
}