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


C# ICriteriaQuery.GetIdentifierColumns方法代码示例

本文整理汇总了C#中ICriteriaQuery.GetIdentifierColumns方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteriaQuery.GetIdentifierColumns方法的具体用法?C# ICriteriaQuery.GetIdentifierColumns怎么用?C# ICriteriaQuery.GetIdentifierColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICriteriaQuery的用法示例。


在下文中一共展示了ICriteriaQuery.GetIdentifierColumns方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToSqlString

		public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			//Implementation changed from H3.2 to use SqlString
			string[] columns = criteriaQuery.GetIdentifierColumns(criteria);
			SqlStringBuilder result = new SqlStringBuilder(4 * columns.Length + 2);
			if (columns.Length > 1)
			{
				result.Add(StringHelper.OpenParen);
			}

			for (int i = 0; i < columns.Length; i++)
			{
				if (i > 0)
				{
					result.Add(" and ");
				}

				result.Add(columns[i])
					.Add(" = ");

				AddValueOrProjection(criteria, criteriaQuery, enabledFilters, result);
			}

			if (columns.Length > 1)
			{
				result.Add(StringHelper.ClosedParen);
			}
			return result.ToSqlString();
		}
开发者ID:juanplopes,项目名称:nhibernate,代码行数:29,代码来源:IdentifierEqExpression.cs

示例2: ToGroupSqlString

		public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			if (!grouped)
			{
				throw new InvalidOperationException("not a grouping projection");
			}
			return new SqlString(StringHelper.Join(",", criteriaQuery.GetIdentifierColumns(criteria)));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:8,代码来源:IdentifierProjection.cs

示例3: ToSqlString

		public override SqlString ToSqlString(ICriteria criteria, int position, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			SqlStringBuilder buf = new SqlStringBuilder();
			string[] cols = criteriaQuery.GetIdentifierColumns(criteria);
			for (int i = 0; i < cols.Length; i++)
			{
				if (i > 0)
				{
					buf.Add(", ");
				}

				buf.Add(cols[i])
					.Add(" as y")
					.Add((position + i).ToString())
					.Add("_");
			}
			return buf.ToSqlString();
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:18,代码来源:IdentifierProjection.cs

示例4: ToSqlString

		/// <summary>
		/// Render a SqlString for the expression.
		/// </summary>
		/// <param name="criteria"></param>
		/// <param name="criteriaQuery"></param>
		/// <param name="enabledFilters"></param>
		/// <returns>
		/// A SqlString that contains a valid Sql fragment.
		/// </returns>
		public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			//criteriaQuery.AddUsedTypedValues(GetTypedValues(criteria, criteriaQuery));
			ISpatialDialect spatialDialect = (ISpatialDialect)criteriaQuery.Factory.Dialect;
			string[] columnsUsingProjection = criteriaQuery.GetColumnsUsingProjection(criteria, this.propertyName);
			IType typeUsingProjection = criteriaQuery.GetTypeUsingProjection(criteria, this.propertyName);
			if (typeUsingProjection.IsCollectionType)
			{
				throw new QueryException(string.Format("cannot use collection property ({0}.{1}) directly in a criterion, use ICriteria.CreateCriteria instead", criteriaQuery.GetEntityName(criteria), this.propertyName));
			}
			string[] keyColumns = criteriaQuery.GetIdentifierColumns(criteria);


			string entityType = criteriaQuery.GetEntityName(criteria, this.propertyName);
			AbstractEntityPersister entityPersister = (AbstractEntityPersister)criteriaQuery.Factory.GetEntityPersister(entityType);

			// Only one key column is assumed
			string keyColumn = keyColumns[0];
			string alias = criteriaQuery.GetSQLAlias(criteria, this.propertyName);
			string tableName = entityPersister.TableName;
			int aliasLength = alias.Length + 1;

			SqlStringBuilder builder = new SqlStringBuilder(10 * columnsUsingProjection.Length);
			for (int i = 0; i < columnsUsingProjection.Length; i++)
			{
				if (i > 0)
				{
					builder.Add(" AND ");
				}
				string geometryColumn = columnsUsingProjection[i].Remove(0, aliasLength);
				builder.Add(spatialDialect.GetSpatialFilterString(alias, geometryColumn, keyColumn, tableName));
			}
			return builder.ToSqlString();
		}
开发者ID:knorrus,项目名称:nhcontrib,代码行数:43,代码来源:SpatialFilterCriterion.cs

示例5: ToGroupSqlString

		public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			return (grouped) ?
			       new SqlString(StringHelper.Join(",", criteriaQuery.GetIdentifierColumns(criteria)))
			       	: base.ToGroupSqlString(criteria, criteriaQuery,enabledFilters);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:6,代码来源:IdentifierProjection.cs

示例6: ToGroupSqlString

		public override SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
		{
			return (grouped) ?
			       new SqlString(StringHelper.Join(",", criteriaQuery.GetIdentifierColumns(criteria)))
			       	: base.ToGroupSqlString(criteria, criteriaQuery);
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:6,代码来源:IdentifierProjection.cs


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