当前位置: 首页>>代码示例>>C#>>正文


C# Dialect.Qualify方法代码示例

本文整理汇总了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;
		}
开发者ID:snbbgyth,项目名称:WorkFlowEngine,代码行数:41,代码来源:IncrementGenerator.cs

示例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;
		}
开发者ID:nhibernate,项目名称:nhibernate-core,代码行数:31,代码来源:TableGenerator.cs

示例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));
		}
开发者ID:renefc3,项目名称:nhibernate,代码行数:38,代码来源:SequenceGenerator.cs

示例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;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:26,代码来源:SequenceStyleGenerator.cs


注:本文中的Dialect.Qualify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。