当前位置: 首页>>代码示例>>C#>>正文


C# ISessionImplementor.IsSaved方法代码示例

本文整理汇总了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 );
				}
			}
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:25,代码来源:PersistentCollection.cs

示例2: Cascade

				public override void Cascade(ISessionImplementor session, object child, object anything)
				{
					log.Debug("cascading to delete()");
					if (session.IsSaved(child))
					{
						session.Delete(child);
					}
				}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:8,代码来源:Cascades.cs

示例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;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:39,代码来源:PersistentCollection.cs

示例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);
                }
            }
        }
开发者ID:zibler,项目名称:zibler,代码行数:27,代码来源:AbstractPersistentCollection.cs


注:本文中的ISessionImplementor.IsSaved方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。