本文整理汇总了C#中ISessionImplementor.InitializeEntity方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionImplementor.InitializeEntity方法的具体用法?C# ISessionImplementor.InitializeEntity怎么用?C# ISessionImplementor.InitializeEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionImplementor
的用法示例。
在下文中一共展示了ISessionImplementor.InitializeEntity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeEntitiesAndCollections
private void InitializeEntitiesAndCollections( IList hydratedObjects, object resultSetId, ISessionImplementor session )
{
if( Persisters.Length > 0 )
{
int hydratedObjectsSize = hydratedObjects.Count;
if( log.IsDebugEnabled )
{
log.Debug( string.Format( "total objects hydrated: {0}", hydratedObjectsSize ) );
}
for( int i = 0; i < hydratedObjectsSize; i++ )
{
session.InitializeEntity( hydratedObjects[ i ] );
}
}
ICollectionPersister collectionPersister = CollectionPersister;
if( collectionPersister != null )
{
//this is a query and we are loading multiple instances of the same collection role
session.EndLoadingCollections( collectionPersister, resultSetId );
}
}
示例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;
}
示例3: InitializeEntitiesAndCollections
internal void InitializeEntitiesAndCollections(
IList hydratedObjects,
object resultSetId,
ISessionImplementor session)
{
ICollectionPersister[] collectionPersisters = CollectionPersisters;
if (collectionPersisters != null)
{
for (int i = 0; i < collectionPersisters.Length; i++)
{
if (collectionPersisters[i].IsArray)
{
//for arrays, we should end the collection load before resolving
//the entities, since the actual array instances are not instantiated
//during loading
//TODO: or we could do this polymorphically, and have two
// different operations implemented differently for arrays
EndCollectionLoad(resultSetId, session, collectionPersisters[i]);
}
}
}
if (hydratedObjects != null)
{
int hydratedObjectsSize = hydratedObjects.Count;
if (log.IsDebugEnabled)
{
log.Debug(string.Format("total objects hydrated: {0}", hydratedObjectsSize));
}
for (int i = 0; i < hydratedObjectsSize; i++)
{
session.InitializeEntity(hydratedObjects[i]);
}
}
if (collectionPersisters != null)
{
for (int i = 0; i < collectionPersisters.Length; i++)
{
if (!collectionPersisters[i].IsArray)
{
//for sets, we should end the collection load after resolving
//the entities, since we might call hashCode() on the elements
//TODO: or we could do this polymorphically, and have two
// different operations implemented differently for arrays
EndCollectionLoad(resultSetId, session, collectionPersisters[i]);
}
}
}
}