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


C# ISessionImplementor.ProxyFor方法代码示例

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


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

示例1: Instantiate

		public object Instantiate( object parent, ISessionImplementor session )
		{
			object result = Instantiate();
			try
			{
				if( parentSetter != null && parent != null )
				{
					parentSetter.Set( result, session.ProxyFor( parent ) );
				}
				return result;
			}
			catch( Exception e )
			{
				throw new InstantiationException( "Could not set component parent for: ", e, componentClass );
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:16,代码来源:ComponentType.cs

示例2: GetRowFromResultSet

		private object GetRowFromResultSet(
			IDataReader resultSet,
			ISessionImplementor session,
			QueryParameters queryParameters,
			IList hydratedObjects,
			object optionalObject,
			object optionalId,
			Key[ ] keys,
			bool returnProxies )
		{
			ILoadable[ ] persisters = Persisters;
			int cols = persisters.Length;
			ICollectionPersister collectionPersister = CollectionPersister;
			int collectionOwner = CollectionOwner;
			string[ ] suffixes = Suffixes;
			LockMode[ ] lockModeArray = GetLockModes( queryParameters.LockModes );
			int[ ] owners = Owners;

			// this is a CollectionInitializer and we are loading up a single collection
			bool hasCollections = collectionPersister != null;
			// this is a query and we are loading multiple instances of the same collection role
			bool hasCollectionOwners = hasCollections && collectionOwner >= 0;

			Key optionalObjectKey;

			if( optionalObject != null )
			{
				optionalObjectKey = new Key( optionalId, session.GetPersister( optionalObject ) );
			}
			else
			{
				optionalObjectKey = null;
			}

			for( int i = 0; i < cols; i++ )
			{
				keys[ i ] = GetKeyFromResultSet(
					i,
					Persisters[ i ],
					( i == cols - 1 ) ? optionalId : null,
					resultSet,
					session );
				//TODO: the i==cols-1 bit depends upon subclass implementation (very bad)
			}

			if( owners != null )
			{
				RegisterNonExists( keys, owners, persisters, session );
			}

			// this call is side-effecty
			object[ ] row = GetRow(
				resultSet,
				persisters,
				suffixes,
				keys,
				optionalObject,
				optionalObjectKey,
				lockModeArray,
				hydratedObjects,
				session );

			if( returnProxies )
			{
				for( int i = 0; i < cols; i++ )
				{
					// now get an existing proxy for each row element (if there is one)
					row[ i ] = session.ProxyFor( persisters[ i ], keys[ i ], row[ i ] );
				}
			}

			if( hasCollections )
			{
				//if null, owner will be retrieved from session
				object owner = hasCollectionOwners ? row[ collectionOwner ] : null;
				object key = owner != null
					? keys[ collectionOwner ].Identifier : null;
				ReadCollectionElement( owner, key, resultSet, session );
			}

			return GetResultColumnOrRow( row, resultSet, session );
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:82,代码来源:Loader.cs

示例3: GetRowFromResultSet

		internal object GetRowFromResultSet(
			IDataReader resultSet,
			ISessionImplementor session,
			QueryParameters queryParameters,
			LockMode[] lockModeArray,
			EntityKey optionalObjectKey,
			IList hydratedObjects,
			EntityKey[] keys,
			bool returnProxies)
		{
			ILoadable[] persisters = EntityPersisters;
			int entitySpan = persisters.Length;

			for (int i = 0; i < entitySpan; i++)
			{
				keys[i] = GetKeyFromResultSet(
					i,
					persisters[i],
					i == entitySpan - 1 ?
					queryParameters.OptionalId : null,
					resultSet,
					session);
				//TODO: the i==entitySpan-1 bit depends upon subclass implementation (very bad)
			}

			RegisterNonExists(keys, persisters, session);

			// this call is side-effecty
			object[] row = GetRow(
				resultSet,
				persisters,
				keys,
				queryParameters.OptionalObject,
				optionalObjectKey,
				lockModeArray,
				hydratedObjects,
				session);

			ReadCollectionElements(row, resultSet, session);

			if (returnProxies)
			{
				// now get an existing proxy for each row element (if there is one)
				for (int i = 0; i < entitySpan; i++)
				{
					object entity = row[i];
					object proxy = session.ProxyFor(persisters[i], keys[i], entity);

					if (entity != proxy)
					{
						// Force the proxy to resolve itself
						NHibernateProxyHelper.GetLazyInitializer((INHibernateProxy) proxy)
							.SetImplementation(entity);
						row[i] = proxy;
					}
				}
			}

			return GetResultColumnOrRow(row, queryParameters.ResultTransformer, resultSet, session);
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:60,代码来源:Loader.cs


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