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


C# Engine.RowSelection类代码示例

本文整理汇总了C#中NHibernate.Engine.RowSelection的典型用法代码示例。如果您正苦于以下问题:C# RowSelection类的具体用法?C# RowSelection怎么用?C# RowSelection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RowSelection类属于NHibernate.Engine命名空间,在下文中一共展示了RowSelection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AbstractQueryImpl

		/// <summary>
		/// 
		/// </summary>
		/// <param name="queryString"></param>
		/// <param name="session"></param>
		public AbstractQueryImpl( string queryString, ISessionImplementor session )
		{
			this.session = session;
			this.queryString = queryString;
			selection = new RowSelection();
			InitParameterBookKeeping();
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:12,代码来源:AbstractQueryImpl.cs

示例2: QueryParameters

		public QueryParameters(IDictionary<string, TypedValue> namedParameters, IDictionary<string, LockMode> lockModes, RowSelection rowSelection, bool isReadOnlyInitialized,
		                       bool readOnly, bool cacheable, string cacheRegion, string comment, bool isLookupByNaturalKey, IResultTransformer transformer)
			: this(
				ArrayHelper.EmptyTypeArray, ArrayHelper.EmptyObjectArray, namedParameters, lockModes, rowSelection, isReadOnlyInitialized, readOnly, cacheable, cacheRegion, comment, null,
				transformer)
		{
			// used by CriteriaTranslator
			NaturalKeyLookup = isLookupByNaturalKey;
		}
开发者ID:Ruhollah,项目名称:nhibernate-core,代码行数:9,代码来源:QueryParameters.cs

示例3: QueryParameters

		public QueryParameters(IType[] positionalParameterTypes, object[] positionalParameterValues,
		                       IDictionary<string, LockMode> lockModes, RowSelection rowSelection, bool cacheable,
		                       string cacheRegion, string comment, bool isLookupByNaturalKey, IResultTransformer transformer)
			: this(
				positionalParameterTypes, positionalParameterValues, null, lockModes, rowSelection, false, cacheable, cacheRegion,
				comment, null, transformer)
		{
			NaturalKeyLookup = isLookupByNaturalKey;
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:9,代码来源:QueryParameters.cs

示例4: EnumerableImpl

		/// <summary>
		/// Create an <see cref="IEnumerable"/> wrapper over an <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to enumerate over.</param>
		/// <param name="cmd">The <see cref="IDbCommand"/> used to create the <see cref="IDataReader"/>.</param>
		/// <param name="sess">The <see cref="ISession"/> to use to load objects.</param>
		/// <param name="types">The <see cref="IType"/>s contained in the <see cref="IDataReader"/>.</param>
		/// <param name="columnNames">The names of the columns in the <see cref="IDataReader"/>.</param>
		/// <param name="selection">The <see cref="RowSelection"/> that should be applied to the <see cref="IDataReader"/>.</param>
		/// <param name="holderInstantiator">Instantiator of the result holder (used for "select new SomeClass(...)" queries).</param>
		/// <remarks>
		/// The <see cref="IDataReader"/> should already be positioned on the first record in <see cref="RowSelection"/>.
		/// </remarks>
		public EnumerableImpl(IDataReader reader, IDbCommand cmd, ISessionImplementor sess, IType[] types,
		                      string[][] columnNames, RowSelection selection,
		                      HolderInstantiator holderInstantiator)
		{
			_reader = reader;
			_cmd = cmd;
			_sess = sess;
			_types = types;
			_names = columnNames;
			_selection = selection;
			_holderInstantiator = holderInstantiator;

			_single = _types.Length == 1;
		}
开发者ID:renefc3,项目名称:nhibernate,代码行数:27,代码来源:EnumerableImpl.cs

示例5: QueryParameters

		public QueryParameters(IType[] positionalParameterTypes, object[] positionalParameterValues, IDictionary<string, TypedValue> namedParameters, IDictionary<string, LockMode> lockModes, RowSelection rowSelection, bool isReadOnlyInitialized, bool readOnly, bool cacheable, string cacheRegion, string comment, object[] collectionKeys, IResultTransformer transformer)
		{
			_positionalParameterTypes = positionalParameterTypes;
			_positionalParameterValues = positionalParameterValues;
			_namedParameters = namedParameters;
			_lockModes = lockModes;
			_rowSelection = rowSelection;
			_cacheable = cacheable;
			_cacheRegion = cacheRegion;
			_comment = comment;
			_collectionKeys = collectionKeys;
			_isReadOnlyInitialized = isReadOnlyInitialized;
			_readOnly = readOnly;
			_resultTransformer = transformer;
		}
开发者ID:pontillo,项目名称:PowerNap,代码行数:15,代码来源:QueryParameters.cs

示例6: EnumerableImpl

		/// <summary>
		/// Create an <see cref="IEnumerable"/> wrapper over an <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to enumerate over.</param>
		/// <param name="cmd">The <see cref="IDbCommand"/> used to create the <see cref="IDataReader"/>.</param>
		/// <param name="sess">The <see cref="ISession"/> to use to load objects.</param>
		/// <param name="types">The <see cref="IType"/>s contained in the <see cref="IDataReader"/>.</param>
		/// <param name="columnNames">The names of the columns in the <see cref="IDataReader"/>.</param>
		/// <param name="selection">The <see cref="RowSelection"/> that should be applied to the <see cref="IDataReader"/>.</param>
		/// <param name="holderType">Optional type of the result holder (used for "select new SomeClass(...)" queries).</param>
		/// <remarks>
		/// The <see cref="IDataReader"/> should already be positioned on the first record in <see cref="RowSelection"/>.
		/// </remarks>
		public EnumerableImpl( IDataReader reader, IDbCommand cmd, ISessionImplementor sess, IType[ ] types, string[ ][ ] columnNames, RowSelection selection,
			System.Type holderType )
		{
			_reader = reader;
			_cmd = cmd;
			_sess = sess;
			_types = types;
			_names = columnNames;
			_selection = selection;

			if( holderType != null )
			{
				_holderConstructor = NHibernate.Util.ReflectHelper.GetConstructor(
					holderType, types );
			}

			_single = _types.Length == 1;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:31,代码来源:EnumerableImpl.cs

示例7: QueryParameters

		/// <summary>
		/// Initializes an instance of the <see cref="QueryParameters"/> class.
		/// </summary>
		/// <param name="positionalParameterTypes">An array of <see cref="IType"/> objects for the parameters.</param>
		/// <param name="positionalParameterValues">An array of <see cref="object"/> objects for the parameters.</param>
		/// <param name="namedParameters">An <see cref="IDictionary"/> that is <c>parameter name</c> keyed to a <see cref="TypedValue"/> value.</param>
		/// <param name="lockModes">An <see cref="IDictionary"/> that is <c>hql alias</c> keyed to a LockMode value.</param>
		/// <param name="rowSelection"></param>
		public QueryParameters(
			IType[ ] positionalParameterTypes,
			object[ ] positionalParameterValues,
			IDictionary namedParameters,
			IDictionary lockModes,
			RowSelection rowSelection,
			bool cacheable,
			string cacheRegion,
			bool forceCacheRefresh )
		{
			_positionalParameterTypes = positionalParameterTypes;
			_positionalParameterValues = positionalParameterValues;
			_namedParameters = namedParameters;
			_lockModes = lockModes;
			_rowSelection = rowSelection;
			_cacheable = cacheable;
			_cacheRegion = cacheRegion;
			_forceCacheRefresh = forceCacheRefresh;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:27,代码来源:QueryParameters.cs

示例8: GetSubSelectWithLimits

		protected SqlString GetSubSelectWithLimits(SqlString subquery, ICollection<IParameterSpecification> parameterSpecs, RowSelection processedRowSelection, IDictionary<string, TypedValue> parameters)
		{
			ISessionFactoryImplementor sessionFactory = Factory;
			Dialect.Dialect dialect = sessionFactory.Dialect;

			RowSelection selection = processedRowSelection;
			bool useLimit = UseLimit(selection, dialect);
			if (useLimit)
			{
				bool hasFirstRow = GetFirstRow(selection) > 0;
				bool useOffset = hasFirstRow && dialect.SupportsLimitOffset;
				int max = GetMaxOrLimit(dialect, selection);
				int? skip = useOffset ? (int?)dialect.GetOffsetValue(GetFirstRow(selection)) : null;
				int? take = max != int.MaxValue ? (int?)max : null;

				Parameter skipSqlParameter = null;
				Parameter takeSqlParameter = null;
				if (skip.HasValue)
				{
					string skipParameterName = "nhsubselectskip";
					var skipParameter = new NamedParameterSpecification(1, 0, skipParameterName) { ExpectedType = NHibernateUtil.Int32 };
					skipSqlParameter = Parameter.Placeholder;
					skipSqlParameter.BackTrack = skipParameter.GetIdsForBackTrack(sessionFactory).First();
					parameters.Add(skipParameterName, new TypedValue(skipParameter.ExpectedType, skip.Value, EntityMode.Poco));
					parameterSpecs.Add(skipParameter);
				}
				if (take.HasValue)
				{
					string takeParameterName = "nhsubselecttake";
					var takeParameter = new NamedParameterSpecification(1, 0, takeParameterName) { ExpectedType = NHibernateUtil.Int32 };
					takeSqlParameter = Parameter.Placeholder;
					takeSqlParameter.BackTrack = takeParameter.GetIdsForBackTrack(sessionFactory).First();
					parameters.Add(takeParameterName, new TypedValue(takeParameter.ExpectedType, take.Value, EntityMode.Poco));
					parameterSpecs.Add(takeParameter);
				}

				// The dialect can move the given parameters where he need, what it can't do is generates new parameters loosing the BackTrack.
				SqlString result;
				if (TryGetLimitString(dialect, subquery, skip, take, skipSqlParameter, takeSqlParameter, out result)) return result;
			}
			return subquery;
		}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:42,代码来源:CollectionLoader.cs

示例9: EnumerableImpl

		/// <summary>
		/// Create an <see cref="IEnumerable"/> wrapper over an <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to enumerate over.</param>
		/// <param name="cmd">The <see cref="IDbCommand"/> used to create the <see cref="IDataReader"/>.</param>
		/// <param name="session">The <see cref="ISession"/> to use to load objects.</param>
		/// <param name="readOnly"></param>
		/// <param name="types">The <see cref="IType"/>s contained in the <see cref="IDataReader"/>.</param>
		/// <param name="columnNames">The names of the columns in the <see cref="IDataReader"/>.</param>
		/// <param name="selection">The <see cref="RowSelection"/> that should be applied to the <see cref="IDataReader"/>.</param>
		/// <param name="holderInstantiator">Instantiator of the result holder (used for "select new SomeClass(...)" queries).</param>
		/// <remarks>
		/// The <see cref="IDataReader"/> should already be positioned on the first record in <see cref="RowSelection"/>.
		/// </remarks>
		public EnumerableImpl(IDataReader reader,
							  IDbCommand cmd,
							  IEventSource session,
							  bool readOnly,
							  IType[] types,
							  string[][] columnNames,
							  RowSelection selection,
							  HolderInstantiator holderInstantiator)
		{
			_reader = reader;
			_cmd = cmd;
			_session = session;
			_readOnly = readOnly;
			_types = types;
			_names = columnNames;
			_selection = selection;
			_holderInstantiator = holderInstantiator;

			_single = _types.Length == 1;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:34,代码来源:EnumerableImpl.cs

示例10: UseLimit

		/// <summary>
		/// Should we pre-process the SQL string, adding a dialect-specific
		/// LIMIT clause.
		/// </summary>
		/// <param name="selection"></param>
		/// <param name="dialect"></param>
		/// <returns></returns>
		internal static bool UseLimit(RowSelection selection, Dialect.Dialect dialect)
		{
			return dialect.SupportsLimit && HasMaxRows(selection);
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:11,代码来源:Loader.cs

示例11: GetMaxOrLimit

		/// <summary> 
		/// Some dialect-specific LIMIT clauses require the maximium last row number
		/// (aka, first_row_number + total_row_count), while others require the maximum
		/// returned row count (the total maximum number of rows to return). 
		/// </summary>
		/// <param name="selection">The selection criteria </param>
		/// <param name="dialect">The dialect </param>
		/// <returns> The appropriate value to bind into the limit clause. </returns>
		internal static int GetMaxOrLimit(Dialect.Dialect dialect, RowSelection selection)
		{
			int firstRow = GetFirstRow(selection);
			int lastRow = selection.MaxRows;

			if (dialect.UseMaxForLimit)
			{
				return lastRow + firstRow;
			}
			else
			{
				return lastRow;
			}
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:22,代码来源:Loader.cs

示例12: HasMaxRows

		internal static bool HasMaxRows(RowSelection selection)
		{
			// it used to be selection.MaxRows != null -> since an Int32 will always
			// have a value I'll compare it to the static field NoValue used to initialize 
			// max rows to nothing
			return selection != null && selection.MaxRows != RowSelection.NoValue;
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:7,代码来源:Loader.cs

示例13: GetFirstRow

		internal static int GetFirstRow(RowSelection selection)
		{
			if (selection == null || !selection.DefinesLimits)
			{
				return 0;
			}
			else
			{
				return selection.FirstRow > 0 ? selection.FirstRow : 0;
			}
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:11,代码来源:Loader.cs

示例14: GetQueryParameters

		public QueryParameters GetQueryParameters()
		{
			ArrayList values = new ArrayList();
			ArrayList types = new ArrayList();

			foreach (CriteriaImpl.CriterionEntry ce in rootCriteria.IterateExpressionEntries())
			{
				TypedValue[] tv = ce.Criterion.GetTypedValues(ce.Criteria, this);
				for (int i = 0; i < tv.Length; i++)
				{
					values.Add(tv[i].Value);
					types.Add(tv[i].Type);
				}
			}
			if (rootCriteria.Projection != null)
			{
				TypedValue[] tv = rootCriteria.Projection.GetTypedValues(rootCriteria.ProjectionCriteria, this);
				for (int i = 0; i < tv.Length; i++)
				{
					values.Add(tv[i].Value);
					types.Add(tv[i].Type);
				}
			}

			object[] valueArray = values.ToArray();
			IType[] typeArray = (IType[])types.ToArray(typeof(IType));

			RowSelection selection = new RowSelection();
			selection.FirstRow = rootCriteria.FirstResult;
			selection.MaxRows = rootCriteria.MaxResults;
			selection.Timeout = rootCriteria.Timeout;
			selection.FetchSize = rootCriteria.FetchSize;

			IDictionary lockModes = new Hashtable();
			foreach (DictionaryEntry me in rootCriteria.LockModes)
			{
				ICriteria subcriteria = GetAliasedCriteria((string)me.Key);
				lockModes[GetSQLAlias(subcriteria)] = me.Value;
			}

			foreach (CriteriaImpl.Subcriteria subcriteria in rootCriteria.IterateSubcriteria())
			{
				LockMode lm = subcriteria.LockMode;
				if (lm != null)
				{
					lockModes[GetSQLAlias(subcriteria)] = lm;
				}
			}

			return new QueryParameters(
				typeArray,
				valueArray,
				lockModes,
				selection,
				rootCriteria.Cacheable,
				rootCriteria.CacheRegion,
				string.Empty, // TODO H3: rootCriteria.Comment,
				rootCriteria.IsLookupByNaturalKey(),
				null
				);
		}
开发者ID:pallmall,项目名称:WCell,代码行数:61,代码来源:CriteriaQueryTranslator.cs

示例15: Advance

		/// <summary>
		/// Advance the cursor to the first required row of the <c>IDataReader</c>
		/// </summary>
		internal static void Advance(IDataReader rs, RowSelection selection)
		{
			int firstRow = GetFirstRow(selection);

			if (firstRow != 0)
			{
				// DataReaders are forward-only, readonly, so we have to step through
				for (int i = 0; i < firstRow; i++)
				{
					rs.Read();
				}
			}
		}
开发者ID:remcoros,项目名称:nhibernate,代码行数:16,代码来源:Loader.cs


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