本文整理汇总了C#中SqlWriter.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SqlWriter.ToString方法的具体用法?C# SqlWriter.ToString怎么用?C# SqlWriter.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlWriter
的用法示例。
在下文中一共展示了SqlWriter.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAddColumnStatement
public static Statement CreateAddColumnStatement(string tableName, Column column)
{
var writer = new SqlWriter();
writer.Alter.Table.QuotedName(tableName).Add.Flush();
WriteColumnDefinition(writer, column);
return new Statement(writer.ToString(), Statement.StatementType.Text, Statement.ResultType.None);
}
示例2: CreateGetIndexesStatement
public static Statement CreateGetIndexesStatement(string tableName)
{
var writer = new SqlWriter();
writer.Select.
Write(System.Indexes.Aliased.Name).Trim().Comma.
Write(System.Indexes.Aliased.Type).Trim().Comma.
Write(System.Indexes.Aliased.IsUnique).Trim().Comma.
Write(System.Indexes.Aliased.IsPrimaryKey).Trim().Comma.
Write(System.Columns.Aliased.Name).As.QuotedName(SqlWriter.Aliases.ColumnName).Trim().Comma.
Write(System.IndexColumns.Aliased.IsDescendingKey).
From.Write(System.Indexes.TableName).Write(System.Indexes.TableAlias).
Join.Write(System.IndexColumns.TableName).Write(System.IndexColumns.TableAlias).On.
Write(System.Indexes.Aliased.ObjectId).Equal.Write(System.IndexColumns.Aliased.ObjectId).And.
Write(System.Indexes.Aliased.IndexId).Equal.Write(System.IndexColumns.Aliased.IndexId).
Join.Write(System.Columns.TableName).Write(System.Columns.TableAlias).On.
Write(System.IndexColumns.Aliased.ObjectId).Equal.Write(System.Columns.Aliased.ObjectId).And.
Write(System.IndexColumns.Aliased.ColumnId).Equal.Write(System.Columns.Aliased.ColumnId).
Where.Write(System.Indexes.Aliased.ObjectId).Equal.ObjectId(tableName).
OrderBy.Write(System.Indexes.Aliased.Name).Flush();
return new Statement(writer.ToString(), Statement.StatementType.Text, Statement.ResultType.Multiple);
}
示例3: CreateColumnsIntersectionStatement
public static Statement CreateColumnsIntersectionStatement(IEnumerable<string> tables)
{
var sql = new SqlWriter();
foreach (var table in tables.Select((x, i) => new { First = i == 0, Name = x }))
{
if (!table.First) sql.Intersect.Flush();
sql.Select.QuotedName(System.Columns.Name).Trim().Comma.
Case.QuotedName(System.Columns.SystemTypeId).When.DataTypeId(DataTypes.VarChar.SqlId).Then.DataTypeId(DataTypes.NVarChar.SqlId).
When.DataTypeId(DataTypes.Char.SqlId).Then.DataTypeId(DataTypes.NChar.SqlId).
When.DataTypeId(DataTypes.Text.SqlId).Then.DataTypeId(DataTypes.NText.SqlId).
Else.QuotedName(System.Columns.SystemTypeId).End.As.QuotedName(System.Columns.SystemTypeId).Trim().Comma.
Case.QuotedName(System.Columns.UserTypeId).When.DataTypeId(DataTypes.VarChar.SqlId).Then.DataTypeId(DataTypes.NVarChar.SqlId).
When.DataTypeId(DataTypes.Char.SqlId).Then.DataTypeId(DataTypes.NChar.SqlId).
When.DataTypeId(DataTypes.Text.SqlId).Then.DataTypeId(DataTypes.NText.SqlId).
Else.QuotedName(System.Columns.UserTypeId).End.As.QuotedName(System.Columns.UserTypeId).
From.Write(System.Columns.TableName).
Where.QuotedName(System.Columns.ObjectId).Equal.ObjectId(table.Name);
}
return new Statement(sql.ToString(), Statement.StatementType.Text, Statement.ResultType.Multiple);
}
示例4: Statement
MigrationStatement Statement(SqlWriter sqlWriter, bool suppressTransaction = false)
{
return Statement(sqlWriter.ToString(), suppressTransaction);
}