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