本文整理汇总了C#中IEntityPersister.Load方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityPersister.Load方法的具体用法?C# IEntityPersister.Load怎么用?C# IEntityPersister.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityPersister
的用法示例。
在下文中一共展示了IEntityPersister.Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFromDatasource
/// <summary>
/// Performs the process of loading an entity from the configured underlying datasource.
/// </summary>
/// <param name="event">The load event </param>
/// <param name="persister">The persister for the entity being requested for load </param>
/// <param name="keyToLoad">The EntityKey representing the entity to be loaded. </param>
/// <param name="options">The load options. </param>
/// <returns> The object loaded from the datasource, or null if not found. </returns>
protected virtual object LoadFromDatasource(LoadEvent @event, IEntityPersister persister, EntityKey keyToLoad, LoadType options)
{
ISessionImplementor source = @event.Session;
bool statsEnabled = source.Factory.Statistics.IsStatisticsEnabled;
var stopWath = new Stopwatch();
if (statsEnabled)
{
stopWath.Start();
}
object entity = persister.Load(@event.EntityId, @event.InstanceToLoad, @event.LockMode, source);
if (@event.IsAssociationFetch && statsEnabled)
{
stopWath.Stop();
source.Factory.StatisticsImplementor.FetchEntity(@event.EntityClassName, stopWath.Elapsed);
}
return entity;
}
示例2: LoadFromDatasource
/// <summary>
/// Performs the process of loading an entity from the configured underlying datasource.
/// </summary>
/// <param name="event">The load event </param>
/// <param name="persister">The persister for the entity being requested for load </param>
/// <param name="keyToLoad">The EntityKey representing the entity to be loaded. </param>
/// <param name="options">The load options. </param>
/// <returns> The object loaded from the datasource, or null if not found. </returns>
protected virtual object LoadFromDatasource(LoadEvent @event, IEntityPersister persister, EntityKey keyToLoad, LoadType options)
{
ISessionImplementor source = @event.Session;
object entity = persister.Load(@event.EntityId, @event.InstanceToLoad, @event.LockMode, source);
if (@event.IsAssociationFetch && source.Factory.Statistics.IsStatisticsEnabled)
{
source.Factory.StatisticsImplementor.FetchEntity(@event.EntityClassName);
}
return entity;
}