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


C# ICriteriaQuery.GetSQLAlias方法代码示例

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


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

示例1: ToSqlString

		public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery)
		{
			//SqlString result = new SqlString(criteriaQuery.GetSQLAlias(criteria));
			//result.Replace(sql, "{alias}");
			//return result;
			return new SqlString(StringHelper.Replace(sql, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:SQLProjection.cs

示例2: ToSqlString

		public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			string entityName = criteriaQuery.GetEntityName(criteria, propertyName);
			string actualPropertyName = criteriaQuery.GetPropertyName(propertyName);
			string sqlAlias = criteriaQuery.GetSQLAlias(criteria, propertyName);

			ISessionFactoryImplementor factory = criteriaQuery.Factory;
			IQueryableCollection collectionPersister = GetQueryableCollection(entityName, actualPropertyName, factory);

			string[] collectionKeys = collectionPersister.KeyColumnNames;
			string[] ownerKeys = ((ILoadable)factory.GetEntityPersister(entityName)).IdentifierColumnNames;

			StringBuilder innerSelect = new StringBuilder();
			innerSelect.Append("(select 1 from ")
				.Append(collectionPersister.TableName)
				.Append(" where ")
				.Append(
				new ConditionalFragment().SetTableAlias(sqlAlias).SetCondition(ownerKeys, collectionKeys).ToSqlStringFragment());
			if (collectionPersister.HasWhere)
			{
				innerSelect.Append(" and (")
					.Append(collectionPersister.GetSQLWhereString(collectionPersister.TableName))
					.Append(") ");
			}

			innerSelect.Append(")");

			return new SqlString(new string[] {ExcludeEmpty ? "exists" : "not exists", innerSelect.ToString()});
		}
开发者ID:jaundice,项目名称:nhibernate-core,代码行数:29,代码来源:AbstractEmptinessExpression.cs

示例3: ToSqlString

		public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			//SqlString result = new SqlString(criteriaQuery.GetSQLAlias(criteria));
			//result.Replace(sql, "{alias}");
			//return result;
			return new SqlString(StringHelper.Replace(sql, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:7,代码来源:SQLProjection.cs

示例4: ToSqlString

		public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			var parameters = _sql.GetParameters().ToList();
			var paramPos = 0;
			for (int i = 0; i < _typedValues.Length; i++)
			{
				var controlledParameters = criteriaQuery.NewQueryParameter(_typedValues[i]);
				foreach (Parameter parameter in controlledParameters)
				{
					parameters[paramPos++].BackTrack = parameter.BackTrack;
				}
			}
			return _sql.Replace("{alias}", criteriaQuery.GetSQLAlias(criteria));
		}
开发者ID:hoangduc007,项目名称:nhibernate-core,代码行数:14,代码来源:SQLCriterion.cs

示例5: ToGroupSqlString

		public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			return new SqlString(StringHelper.Replace(groupBy, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:4,代码来源:SQLProjection.cs

示例6: 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

示例7: ToSqlString

		public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
		{
			return _sql.Replace("{alias}", criteriaQuery.GetSQLAlias(criteria));
		}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:4,代码来源:SQLCriterion.cs

示例8: ToSqlString

 public SqlString ToSqlString(ICriteria criteria, int loc, ICriteriaQuery criteriaQuery,
                              IDictionary<string, IFilter> enabledFilters)
 {
     return new SqlString(StringHelper.Replace(this.sql, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
 }
开发者ID:Rookian,项目名称:S.O.L.I.D.Ariha,代码行数:5,代码来源:NHibernate.Criterion.SQLProjection.cs

示例9: ToGroupSqlString

		public SqlString ToGroupSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
		{
			return new SqlString(StringHelper.Replace(groupBy, "{alias}", criteriaQuery.GetSQLAlias(criteria)));
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:4,代码来源:SQLProjection.cs


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