本文整理汇总了C#中IEntityPersister.GetConcreteProxyClass方法的典型用法代码示例。如果您正苦于以下问题:C# IEntityPersister.GetConcreteProxyClass方法的具体用法?C# IEntityPersister.GetConcreteProxyClass怎么用?C# IEntityPersister.GetConcreteProxyClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityPersister
的用法示例。
在下文中一共展示了IEntityPersister.GetConcreteProxyClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NarrowProxy
/// <summary>
/// If the existing proxy is insufficiently "narrow" (derived), instantiate a new proxy
/// and overwrite the registration of the old one. This breaks == and occurs only for
/// "class" proxies rather than "interface" proxies. Also init the proxy to point to
/// the given target implementation if necessary.
/// </summary>
/// <param name="proxy">The proxy instance to be narrowed. </param>
/// <param name="persister">The persister for the proxied entity. </param>
/// <param name="key">The internal cache key for the proxied entity. </param>
/// <param name="obj">(optional) the actual proxied entity instance. </param>
/// <returns> An appropriately narrowed instance. </returns>
public object NarrowProxy(INHibernateProxy proxy, IEntityPersister persister, EntityKey key, object obj)
{
bool alreadyNarrow = persister.GetConcreteProxyClass(session.EntityMode).IsAssignableFrom(proxy.GetType());
if (!alreadyNarrow)
{
if (ProxyWarnLog.IsWarnEnabled)
{
ProxyWarnLog.Warn("Narrowing proxy to " + persister.GetConcreteProxyClass(session.EntityMode) + " - this operation breaks ==");
}
if (obj != null)
{
proxiesByKey.Remove(key);
return obj; //return the proxied object
}
else
{
proxy = (INHibernateProxy)persister.CreateProxy(key.Identifier, session);
proxiesByKey[key] = proxy; //overwrite old proxy
return proxy;
}
}
else
{
if (obj != null)
{
proxy.HibernateLazyInitializer.SetImplementation(obj);
}
return proxy;
}
}