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


C# ISessionImplementor.PostHydrate方法代码示例

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


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

示例1: LoadFromResultSet

		/// <summary>
		/// Hydrate the state of an object from the SQL <c>IDataReader</c>, into
		/// an array of "hydrated" values (do not resolve associations yet),
		/// and pass the hydrated state to the session.
		/// </summary>
		/// <param name="rs"></param>
		/// <param name="i"></param>
		/// <param name="obj"></param>
		/// <param name="key"></param>
		/// <param name="suffix"></param>
		/// <param name="lockMode"></param>
		/// <param name="rootPersister"></param>
		/// <param name="session"></param>
		private void LoadFromResultSet( IDataReader rs, int i, object obj, Key key, string suffix, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session )
		{
			if( log.IsDebugEnabled )
			{
				log.Debug( "Initializing object from DataReader: " + key );
			}

			// add temp entry so that the next step is circular-reference
			// safe - only needed because some types don't take proper
			// advantage of two-phase-load (esp. components)
			session.AddUninitializedEntity( key, obj, lockMode );

			// Get the persister for the _subclass_
			ILoadable persister = ( ILoadable ) session.GetPersister( obj );

			// This is not very nice (and quite slow):
			string[ ][ ] cols = persister == rootPersister ?
				suffixedPropertyColumns[ i ] :
				GetSuffixedPropertyAliases( persister, suffix );

			object id = key.Identifier;
			object[ ] values = Hydrate( rs, id, obj, persister, session, cols );
			session.PostHydrate( persister, id, values, obj, lockMode );
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:37,代码来源:Loader.cs

示例2: Load

		public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session)
		{
			Custom clone = null;
			Custom obj = (Custom) Instances[id];
			if(obj!=null) 
			{
				clone = (Custom)obj.Clone();
				session.AddUninitializedEntity( new Key(id, this), clone, LockMode.None );
				session.PostHydrate( this, id, new string[] {obj.Name}, clone, LockMode.None );
				session.InitializeEntity(clone);
			}
			return clone;

		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:14,代码来源:CustomPersister.cs

示例3: LoadFromResultSet

		/// <summary>
		/// Hydrate the state of an object from the SQL <c>IDataReader</c>, into
		/// an array of "hydrated" values (do not resolve associations yet),
		/// and pass the hydrated state to the session.
		/// </summary>
		private void LoadFromResultSet(
			IDataReader rs,
			int i,
			object obj,
			System.Type instanceClass,
			EntityKey key,
			LockMode lockMode,
			ILoadable rootPersister,
			ISessionImplementor session)
		{
			object id = key.Identifier;

			// Get the persister for the _subclass_
			ILoadable persister = (ILoadable) Factory.GetEntityPersister(instanceClass);

			if (log.IsDebugEnabled)
			{
				log.Debug("Initializing object from DataReader: " + MessageHelper.InfoString(persister, id));
			}

			// add temp entry so that the next step is circular-reference
			// safe - only needed because some types don't take proper
			// advantage of two-phase-load (esp. components)
			session.AddUninitializedEntity(key, obj, lockMode);

			// This is not very nice (and quite slow):
			string[][] cols = persister == rootPersister ?
			                  EntityAliases[i].SuffixedPropertyAliases :
			                  EntityAliases[i].GetSuffixedPropertyAliases(persister);

			object[] values = Hydrate(
				rs,
				id,
				obj,
				persister,
				session,
				cols);

			// TODO H3:
//			IAssociationType[] ownerAssociationTypes = OwnerAssociationTypes;
//
//			if ( ownerAssociationTypes != null && ownerAssociationTypes[i] != null ) 
//			{
//				string ukName = ownerAssociationTypes[i].RHSUniqueKeyPropertyName;
//				if (ukName!=null) 
//				{
//					int index = ( (IUniqueKeyLoadable) persister ).GetPropertyIndex(ukName);
//					IType type = persister.PropertyTypes[index];
//	
//					// polymorphism not really handled completely correctly,
//					// perhaps...well, actually its ok, assuming that the
//					// entity name used in the lookup is the same as the
//					// the one used here, which it will be
//	
//					EntityUniqueKey euk = new EntityUniqueKey( 
//						rootPersister.MappedClass, //polymorphism comment above
//						ukName,
//						type.SemiResolve( values[ index ], session, obj ),
//						type,
//						session.EntityMode, session.Factory
//						);
//					session.AddEntity( euk, obj );
//				}
//			}

			session.PostHydrate(persister, id, values, obj, lockMode);
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:72,代码来源:Loader.cs


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