本文整理汇总了C#中ISessionImplementor.Instantiate方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionImplementor.Instantiate方法的具体用法?C# ISessionImplementor.Instantiate怎么用?C# ISessionImplementor.Instantiate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionImplementor
的用法示例。
在下文中一共展示了ISessionImplementor.Instantiate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstanceNotYetLoaded
/// <summary>
/// The entity instance is not in the session cache
/// </summary>
private object InstanceNotYetLoaded(IDataReader dr, int i, ILoadable persister, EntityKey key, LockMode lockMode,
string rowIdAlias, EntityKey optionalObjectKey, object optionalObject,
IList hydratedObjects, ISessionImplementor session)
{
object obj;
string instanceClass = GetInstanceClass(dr, i, persister, key.Identifier, session);
if (optionalObjectKey != null && key.Equals(optionalObjectKey))
{
// its the given optional object
obj = optionalObject;
}
else
{
obj = session.Instantiate(instanceClass, key.Identifier);
}
// need to hydrate it
// grab its state from the DataReader and keep it in the Session
// (but don't yet initialize the object itself)
// note that we acquired LockMode.READ even if it was not requested
LockMode acquiredLockMode = lockMode == LockMode.None ? LockMode.Read : lockMode;
LoadFromResultSet(dr, i, obj, instanceClass, key, rowIdAlias, acquiredLockMode, persister, session);
// materialize associations (and initialize the object) later
hydratedObjects.Add(obj);
return obj;
}