本文整理汇总了C#中Dialect.Qualify方法的典型用法代码示例。如果您正苦于以下问题:C# Dialect.Qualify方法的具体用法?C# Dialect.Qualify怎么用?C# Dialect.Qualify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialect
的用法示例。
在下文中一共展示了Dialect.Qualify方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="parms"></param>
/// <param name="dialect"></param>
public void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect dialect)
{
string tableList;
string column;
string schema;
string catalog;
if (!parms.TryGetValue("tables", out tableList))
parms.TryGetValue(PersistentIdGeneratorParmsNames.Tables, out tableList);
string[] tables = tableList.Split(", ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (!parms.TryGetValue("column", out column))
parms.TryGetValue(PersistentIdGeneratorParmsNames.PK, out column);
returnClass = type.ReturnedClass;
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schema);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalog);
StringBuilder buf = new StringBuilder();
for (int i = 0; i < tables.Length; i++)
{
if (tables.Length > 1)
{
buf.Append("select ").Append(column).Append(" from ");
}
buf.Append(dialect.Qualify(catalog, schema, tables[i]));
if (i < tables.Length - 1)
buf.Append(" union ");
}
if (tables.Length > 1)
{
buf.Insert(0, "( ").Append(" ) ids_");
column = "ids_." + column;
}
sql = "select max(" + column + ") from " + buf;
}
示例2: DetermineGeneratorTableName
/// <summary>
/// Determine the table name to use for the generator values. Called during configuration.
/// </summary>
/// <param name="parms">The parameters supplied in the generator config (plus some standard useful extras).</param>
/// <param name="dialect">The dialect</param>
protected string DetermineGeneratorTableName(IDictionary<string, string> parms, Dialect.Dialect dialect)
{
string name = PropertiesHelper.GetString(TableParam, parms, DefaultTable);
bool isGivenNameUnqualified = name.IndexOf('.') < 0;
if (isGivenNameUnqualified)
{
// NHibernate doesn't seem to have anything resembling this ObjectNameNormalizer. Ignore that for now.
//ObjectNameNormalizer normalizer = ( ObjectNameNormalizer ) params.get( IDENTIFIER_NORMALIZER );
//name = normalizer.normalizeIdentifierQuoting( name );
//// if the given name is un-qualified we may neen to qualify it
//string schemaName = normalizer.normalizeIdentifierQuoting( params.getProperty( SCHEMA ) );
//string catalogName = normalizer.normalizeIdentifierQuoting( params.getProperty( CATALOG ) );
string schemaName;
string catalogName;
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schemaName);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalogName);
name = dialect.Qualify(catalogName, schemaName, name);
}
else
{
// if already qualified there is not much we can do in a portable manner so we pass it
// through and assume the user has set up the name correctly.
}
return name;
}
示例3: Configure
/// <summary>
/// Configures the SequenceGenerator by reading the value of <c>sequence</c> and
/// <c>schema</c> from the <c>parms</c> parameter.
/// </summary>
/// <param name="type">The <see cref="IType"/> the identifier should be.</param>
/// <param name="parms">An <see cref="IDictionary"/> of Param values that are keyed by parameter name.</param>
/// <param name="dialect">The <see cref="Dialect.Dialect"/> to help with Configuration.</param>
public virtual void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect dialect)
{
var nativeSequenceName = PropertiesHelper.GetString(Sequence, parms, "hibernate_sequence");
bool needQuote = StringHelper.IsBackticksEnclosed(nativeSequenceName);
bool isQuelified = nativeSequenceName.IndexOf('.') > 0;
if (isQuelified)
{
string qualifier = StringHelper.Qualifier(nativeSequenceName);
nativeSequenceName = StringHelper.Unqualify(nativeSequenceName);
nativeSequenceName = StringHelper.PurgeBackticksEnclosing(nativeSequenceName);
sequenceName = qualifier + '.' + (needQuote ? dialect.QuoteForTableName(nativeSequenceName) : nativeSequenceName);
}
else
{
nativeSequenceName = StringHelper.PurgeBackticksEnclosing(nativeSequenceName);
sequenceName = needQuote ? dialect.QuoteForTableName(nativeSequenceName) : nativeSequenceName;
}
string schemaName;
string catalogName;
parms.TryGetValue(Parameters, out parameters);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schemaName);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalogName);
if (!isQuelified)
{
sequenceName = dialect.Qualify(catalogName, schemaName, sequenceName);
}
identifierType = type;
sql = new SqlString(dialect.GetSequenceNextValString(sequenceName));
}
示例4: DetermineSequenceName
/// <summary>
/// Determine the name of the sequence (or table if this resolves to a physical table) to use.
/// Called during configuration.
/// </summary>
/// <param name="parms"></param>
/// <param name="dialect"></param>
/// <returns></returns>
protected string DetermineSequenceName(IDictionary<string, string> parms, Dialect.Dialect dialect)
{
string sequenceName = PropertiesHelper.GetString(SequenceParam, parms, DefaultSequenceName);
if (sequenceName.IndexOf('.') < 0)
{
string schemaName;
string catalogName;
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schemaName);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalogName);
sequenceName = dialect.Qualify(catalogName, schemaName, sequenceName);
}
else
{
// If already qualified there is not much we can do in a portable manner so we pass it
// through and assume the user has set up the name correctly.
}
return sequenceName;
}