本文整理汇总了C#中Dialect.QuoteForAliasName方法的典型用法代码示例。如果您正苦于以下问题:C# Dialect.QuoteForAliasName方法的具体用法?C# Dialect.QuoteForAliasName怎么用?C# Dialect.QuoteForAliasName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialect
的用法示例。
在下文中一共展示了Dialect.QuoteForAliasName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToAliasString
/// <summary>
///
/// </summary>
/// <param name="sqlIdentifier"></param>
/// <param name="dialect"></param>
/// <returns></returns>
public string ToAliasString( string sqlIdentifier, Dialect.Dialect dialect )
{
bool isQuoted = dialect.IsQuoted( sqlIdentifier );
string unquoted;
if( isQuoted )
{
unquoted = dialect.UnQuote( sqlIdentifier );
}
else
{
unquoted = sqlIdentifier;
}
// Oracle doesn't like underscores at the start of identifiers (NH-320).
// It should be safe to trim them here, because the aliases are postfixed
// with a unique number anyway, so they won't collide.
unquoted = unquoted.TrimStart( '_' );
if( unquoted.Length > length )
{
unquoted = unquoted.Substring( 0, length );
}
if( suffix != null )
{
unquoted += suffix;
}
if( isQuoted )
{
return dialect.QuoteForAliasName( unquoted );
}
else
{
return unquoted;
}
}
示例2: Quote
private static string Quote( string column, Dialect.Dialect dialect )
{
if( column[ 0 ] == '`' )
{
if( column[ column.Length - 1 ] != '`' )
{
throw new ArgumentException( "missing ` in column " + column );
}
return dialect.QuoteForAliasName( column.Substring( 1, column.Length - 2 ) );
}
else
{
return column;
}
}