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


C# ISessionImplementor.GetLoadingCollection方法代码示例

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


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

示例1: HandleEmptyCollections

		/// <summary>
		/// If this is a collection initializer, we need to tell the session that a collection
		/// is being initilized, to account for the possibility of the collection having
		/// no elements (hence no rows in the result set).
		/// </summary>
		/// <param name="keys"></param>
		/// <param name="resultSetId"></param>
		/// <param name="session"></param>
		private void HandleEmptyCollections(
			object[ ] keys,
			object resultSetId,
			ISessionImplementor session
			)
		{
			for( int i = 0; i < keys.Length; i++ )
			{
				if( log.IsDebugEnabled )
				{
					log.Debug( "result set contains (possibly empty) collection: " + MessageHelper.InfoString( CollectionPersister, keys[ i ] ) );
				}
				session.GetLoadingCollection( CollectionPersister, keys[ i ], resultSetId );
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:23,代码来源:Loader.cs

示例2: HandleEmptyCollections

		/// <summary>
		/// If this is a collection initializer, we need to tell the session that a collection
		/// is being initilized, to account for the possibility of the collection having
		/// no elements (hence no rows in the result set).
		/// </summary>
		internal void HandleEmptyCollections(
			object[] keys,
			object resultSetId,
			ISessionImplementor session
			)
		{
			if (keys != null)
			{
				// this is a collection initializer, so we must create a collection
				// for each of the passed-in keys, to account for the possibility
				// that the collection is empty and has no rows in the result set

				ICollectionPersister[] collectionPersisters = CollectionPersisters;
				for (int j = 0; j < collectionPersisters.Length; j++)
				{
					for (int i = 0; i < keys.Length; i++)
					{
						// handle empty collections
						if (log.IsDebugEnabled)
						{
							log.Debug("result set contains (possibly empty) collection: " +
							          MessageHelper.InfoString(collectionPersisters[j], keys[i]));
						}
						session.GetLoadingCollection(collectionPersisters[j], keys[i], resultSetId);
					}
				}
			}
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:33,代码来源:Loader.cs

示例3: ReadCollectionElement

		/// <summary>
		/// Read one collection element from the current row of the ADO.NET result set
		/// </summary>
		/// <param name="optionalOwner"></param>
		/// <param name="optionalKey"></param>
		/// <param name="rs"></param>
		/// <param name="session"></param>
		private void ReadCollectionElement(
			object optionalOwner,
			object optionalKey,
			IDataReader rs,
			ISessionImplementor session
			)
		{
			ICollectionPersister collectionPersister = CollectionPersister;
			object collectionRowKey = collectionPersister.ReadKey( rs, session );
			if( collectionRowKey != null )
			{
				if( log.IsDebugEnabled )
				{
					log.Debug( "found row of collection: " + MessageHelper.InfoString( collectionPersister, collectionRowKey ) );
				}
				object owner = optionalOwner;
				if( owner == null )
				{
					owner = session.GetCollectionOwner( collectionRowKey, collectionPersister );
					if( owner == null )
					{
						//TODO: This is assertion is disabled because there is a bug that means the
						//      original owner of a transient, uninitialized collection is not known 
						//      if the collection is re-referenced by a different object associated 
						//      with the current Session
						//throw new AssertionFailure("bug loading unowned collection");
					}
				}
				PersistentCollection rowCollection = session.GetLoadingCollection( collectionPersister, collectionRowKey, rs );
				if( rowCollection != null )
				{
					rowCollection.ReadFrom( rs, collectionPersister, owner );
				}
			}
			else if( optionalKey != null )
			{
				if( log.IsDebugEnabled )
				{
					log.Debug( "result set contains (possibly empty) collection: " + MessageHelper.InfoString( collectionPersister, optionalKey ) );
				}
				session.GetLoadingCollection( collectionPersister, optionalKey, rs ); // handle empty collection
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:50,代码来源:Loader.cs

示例4: ReadCollectionElement

		/// <summary>
		/// Read one collection element from the current row of the ADO.NET result set
		/// </summary>
		private void ReadCollectionElement(
			object optionalOwner,
			object optionalKey,
			ICollectionPersister persister,
			ICollectionAliases descriptor,
			IDataReader rs,
			ISessionImplementor session
			)
		{
			object collectionRowKey = persister.ReadKey(
				rs,
				descriptor.SuffixedKeyAliases,
				session);

			if (collectionRowKey != null)
			{
				// we found a collection element in the result set

				if (log.IsDebugEnabled)
				{
					log.Debug(
						"found row of collection: " +
						MessageHelper.InfoString(persister, collectionRowKey));
				}

				object owner = optionalOwner;
				if (owner == null)
				{
					owner = session.GetCollectionOwner(collectionRowKey, persister);
					if (owner == null)
					{
						//TODO: This is assertion is disabled because there is a bug that means the
						//      original owner of a transient, uninitialized collection is not known 
						//      if the collection is re-referenced by a different object associated 
						//      with the current Session
						//throw new AssertionFailure("bug loading unowned collection");
					}
				}
				IPersistentCollection rowCollection = session.GetLoadingCollection(persister, collectionRowKey, rs);

				if (rowCollection != null)
				{
					rowCollection.ReadFrom(rs, persister, descriptor, owner);
				}
			}
			else if (optionalKey != null)
			{
				// we did not find a collection element in the result set, so we
				// ensure that a collection is created with the owner's identifier,
				// since what we have is an empty collection

				if (log.IsDebugEnabled)
				{
					log.Debug(
						"result set contains (possibly empty) collection: " +
						MessageHelper.InfoString(persister, optionalKey));
				}
				session.GetLoadingCollection(persister, optionalKey, rs); // handle empty collection
			}

			// else no collection element, but also no owner
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:65,代码来源:Loader.cs


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