本文整理汇总了C#中ISessionImplementor.IsSaved方法的典型用法代码示例。如果您正苦于以下问题:C# ISessionImplementor.IsSaved方法的具体用法?C# ISessionImplementor.IsSaved怎么用?C# ISessionImplementor.IsSaved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISessionImplementor
的用法示例。
在下文中一共展示了ISessionImplementor.IsSaved方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IdentityRemove
public static void IdentityRemove( IList list, object obj, ISessionImplementor session )
{
int indexOfEntityToRemove = -1;
if( session.IsSaved( obj ) )
{
object idOfCurrent = session.GetEntityIdentifierIfNotUnsaved( obj );
for( int i = 0; i < list.Count; i++ )
{
object idOfOld = session.GetEntityIdentifierIfNotUnsaved( list[ i ] );
if( idOfCurrent.Equals( idOfOld ) )
{
// in hibernate this used the Iterator to remove the item - since in .NET
// the Enumerator is read only we have to change the implementation slightly.
indexOfEntityToRemove = i;
break;
}
}
if( indexOfEntityToRemove != -1 )
{
list.RemoveAt( indexOfEntityToRemove );
}
}
}
示例2: Cascade
public override void Cascade(ISessionImplementor session, object child, object anything)
{
log.Debug("cascading to delete()");
if (session.IsSaved(child))
{
session.Delete(child);
}
}
示例3: GetOrphans
protected static ICollection GetOrphans( ICollection oldElements, ICollection currentElements, ISessionImplementor session )
{
// short-circuit(s)
if ( currentElements.Count == 0 )
{
// no new elements, the old list contains only Orphans
return oldElements;
}
if ( oldElements.Count == 0 )
{
// no old elements, so no Orphans neither
return oldElements;
}
// create the collection holding the orphans
IList res = new ArrayList();
// collect EntityIdentifier(s) of the *current* elements - add them into a HashSet for fast access
ISet currentIds = new HashedSet();
foreach ( object current in currentElements )
{
if ( session.IsSaved( current ) )
{
currentIds.Add( session.GetEntityIdentifierIfNotUnsaved( current ) );
}
}
// iterate over the *old* list
foreach ( object old in oldElements )
{
object id = session.GetEntityIdentifierIfNotUnsaved( old );
if ( !currentIds.Contains( id ) )
{
res.Add( old );
}
}
return res;
}
示例4: IdentityRemove
public static void IdentityRemove(IList list, object obj, string entityName, ISessionImplementor session)
{
int indexOfEntityToRemove = -1;
IType idType = session.Factory.GetEntityPersister(entityName).IdentifierType;
if (session.IsSaved(obj))
{
object idOfCurrent = ForeignKeys.GetEntityIdentifierIfNotUnsaved(entityName, obj, session);
for (int i = 0; i < list.Count; i++)
{
object idOfOld = ForeignKeys.GetEntityIdentifierIfNotUnsaved(entityName, list[i], session);
if (idType.IsEqual(idOfOld, idOfCurrent, EntityMode.Poco))
{
// in hibernate this used the Iterator to remove the item - since in .NET
// the Enumerator is read only we have to change the implementation slightly.
indexOfEntityToRemove = i;
break;
}
}
if (indexOfEntityToRemove != -1)
{
list.RemoveAt(indexOfEntityToRemove);
}
}
}