• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ICollectionPersister类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICollectionPersister的典型用法代码示例。如果您正苦于以下问题:C# ICollectionPersister类的具体用法?C# ICollectionPersister怎么用?C# ICollectionPersister使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICollectionPersister类属于命名空间,在下文中一共展示了ICollectionPersister类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CollectionUpdateAction

 public CollectionUpdateAction(
     IPersistentCollection collection, ICollectionPersister persister,
     object key, bool emptySnapshot, ISessionImplementor session)
     : base(persister, collection, key, session)
 {
     this.emptySnapshot = emptySnapshot;
 }
开发者ID:zibler,项目名称:zibler,代码行数:7,代码来源:CollectionUpdateAction.cs


示例2: ReadFrom

		public override object ReadFrom(IDataReader reader, ICollectionPersister role, ICollectionAliases descriptor,
		                                object owner)
		{
			object element = role.ReadElement(reader, owner, descriptor.SuffixedElementAliases, Session);
			bag.Add(element);
			return element;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:PersistentBag.cs


示例3: CopyElement

		protected override object CopyElement(ICollectionPersister persister, object element, ISessionImplementor session, object owner, IDictionary copiedAlready)
		{
			DictionaryEntry de = ( DictionaryEntry ) element;
			return new DictionaryEntry(
				persister.IndexType.Copy( de.Key, null, session, owner, copiedAlready ),
				persister.ElementType.Copy( de.Value, null, session, owner, copiedAlready ) );
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:7,代码来源:MapType.cs


示例4: ScheduledCollectionUpdate

		/// <summary>
		/// Initializes a new instance of <see cref="ScheduledCollectionUpdate"/>.
		/// </summary>
		/// <param name="collection">The <see cref="IPersistentCollection"/> to update.</param>
		/// <param name="persister">The <see cref="ICollectionPersister"/> that is responsible for the persisting the Collection.</param>
		/// <param name="id">The identifier of the Collection owner.</param>
		/// <param name="emptySnapshot">Indicates if the Collection was empty when it was loaded.</param>
		/// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param>
		public ScheduledCollectionUpdate(IPersistentCollection collection, ICollectionPersister persister, object id,
		                                 bool emptySnapshot, ISessionImplementor session)
			: base(persister, id, session)
		{
			_collection = collection;
			_emptySnapshot = emptySnapshot;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:15,代码来源:ScheduledCollectionUpdate.cs


示例5: ScheduledCollectionAction

		/// <summary>
		/// Initializes a new instance of <see cref="ScheduledCollectionAction"/>.
		/// </summary>
		/// <param name="persister">The <see cref="ICollectionPersister"/> that is responsible for the persisting the Collection.</param>
		/// <param name="id">The identifier of the Collection owner.</param>
		/// <param name="session">The <see cref="ISessionImplementor"/> that the Action is occuring in.</param>
		public ScheduledCollectionAction(ICollectionPersister persister, object id, ISessionImplementor session)
		{
			this.persister = persister;
			this.session = session;
			this.id = id;
			this.collectionRole = persister.Role;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:13,代码来源:ScheduledCollectionAction.cs


示例6: LoadingCollectionEntry

		public LoadingCollectionEntry(IDataReader resultSet, ICollectionPersister persister, object key, IPersistentCollection collection)
		{
			this.resultSet = resultSet;
			this.persister = persister;
			this.key = key;
			this.collection = collection;
		}
开发者ID:ray2006,项目名称:WCell,代码行数:7,代码来源:LoadingCollectionEntry.cs


示例7: InitializeCollectionFromCache

		/// <summary> Try to initialize a collection from the cache</summary>
		private bool InitializeCollectionFromCache(object id, ICollectionPersister persister, IPersistentCollection collection, ISessionImplementor source)
		{

			if (!(source.EnabledFilters.Count == 0) && persister.IsAffectedByEnabledFilters(source))
			{
				log.Debug("disregarding cached version (if any) of collection due to enabled filters ");
				return false;
			}

			bool useCache = persister.HasCache && ((source.CacheMode & CacheMode.Get) == CacheMode.Get);

			if (!useCache)
			{
				return false;
			}
			else
			{
				ISessionFactoryImplementor factory = source.Factory;

				CacheKey ck = new CacheKey(id, persister.KeyType, persister.Role, source.EntityMode, factory);
				object ce = persister.Cache.Get(ck, source.Timestamp);

				if (factory.Statistics.IsStatisticsEnabled)
				{
					if (ce == null)
					{
						factory.StatisticsImplementor.SecondLevelCacheMiss(persister.Cache.RegionName);
					}
					else
					{
						factory.StatisticsImplementor.SecondLevelCacheHit(persister.Cache.RegionName);
					}
				}

				if (ce == null)
				{
					log.DebugFormat("Collection cache miss: {0}", ck);
				}
				else
				{
					log.DebugFormat("Collection cache hit: {0}", ck);
				}

				if (ce == null)
				{
					return false;
				}
				else
				{
					IPersistenceContext persistenceContext = source.PersistenceContext;

					CollectionCacheEntry cacheEntry = (CollectionCacheEntry)persister.CacheEntryStructure.Destructure(ce, factory);
					cacheEntry.Assemble(collection, persister, persistenceContext.GetCollectionOwner(id, persister));

					persistenceContext.GetCollectionEntry(collection).PostInitialize(collection);
					return true;
				}
			}
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:60,代码来源:DefaultInitializeCollectionEventListener.cs


示例8: RemoveCollection

		/// <summary> 
		/// Schedules a collection for deletion. 
		/// </summary>
		/// <param name="role">The persister representing the collection to be removed. </param>
		/// <param name="collectionKey">The collection key (differs from owner-id in the case of property-refs). </param>
		/// <param name="source">The session from which the request originated. </param>
		internal void RemoveCollection(ICollectionPersister role, object collectionKey, IEventSource source)
		{
			if (log.IsDebugEnabled)
			{
				log.Debug("collection dereferenced while transient " + MessageHelper.CollectionInfoString(role, ownerIdentifier, source.Factory));
			}
			source.ActionQueue.AddAction(new CollectionRemoveAction(owner, role, collectionKey, false, source));
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:14,代码来源:ReattachVisitor.cs


示例9: AbstractCollectionEvent

		/// <summary> Constructs an AbstractCollectionEvent object. </summary>
		/// <param name="collectionPersister">The collection persister.</param>
		/// <param name="collection">The collection </param>
		/// <param name="source">The Session source </param>
		/// <param name="affectedOwner">The owner that is affected by this event; can be null if unavailable </param>
		/// <param name="affectedOwnerId">
		/// The ID for the owner that is affected by this event; can be null if unavailable
		/// that is affected by this event; can be null if unavailable
		/// </param>
		protected AbstractCollectionEvent(ICollectionPersister collectionPersister, IPersistentCollection collection,
		                               IEventSource source, object affectedOwner, object affectedOwnerId) : base(source)
		{
			this.collection = collection;
			this.affectedOwner = affectedOwner;
			this.affectedOwnerId = affectedOwnerId;
			affectedOwnerEntityName = GetAffectedOwnerEntityName(collectionPersister, affectedOwner, source);
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:17,代码来源:AbstractCollectionEvent.cs


示例10: BatchingCollectionInitializer

		public BatchingCollectionInitializer( ICollectionPersister collPersister, int batchSize, Loader batchLoader, int smallBatchSize, Loader smallBatchLoader, Loader nonBatchLoader )
		{
			this.batchLoader = batchLoader;
			this.nonBatchLoader = nonBatchLoader;
			this.batchSize = batchSize;
			this.collectionPersister = collPersister;
			this.smallBatchLoader = smallBatchLoader;
			this.smallBatchSize = smallBatchSize;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:9,代码来源:BatchingCollectionInitializer.cs


示例11: Snapshot

		protected override ICollection Snapshot(ICollectionPersister persister)
		{
			Hashtable clonedMap = new Hashtable(map.Count);
			foreach (DictionaryEntry e in map)
			{
				clonedMap[e.Key] = persister.ElementType.DeepCopy(e.Value, EntityMode.Poco, persister.Factory);
			}
			return clonedMap;
		}
开发者ID:pallmall,项目名称:WCell,代码行数:9,代码来源:PersistentMap.cs


示例12: BatchingCollectionInitializer

 public BatchingCollectionInitializer(
     ICollectionPersister collectionPersister,
     int[] batchSizes,
     Loader[] loaders)
 {
     this.loaders = loaders;
     this.batchSizes = batchSizes;
     this.collectionPersister = collectionPersister;
 }
开发者ID:zibler,项目名称:zibler,代码行数:9,代码来源:BatchingCollectionInitializer.cs


示例13: Snapshot

		/// <summary>
		/// 
		/// </summary>
		/// <param name="persister"></param>
		/// <returns></returns>
		protected override ICollection Snapshot( ICollectionPersister persister )
		{
			ArrayList clonedList = new ArrayList( list.Count );
			foreach( object obj in list )
			{
				clonedList.Add( persister.ElementType.DeepCopy( obj ) );
			}
			return clonedList;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:14,代码来源:List.cs


示例14: EndLoadingCollections

        /// <summary> 
        /// Finish the process of collection-loading for this bound result set.  Mainly this
        /// involves cleaning up resources and notifying the collections that loading is
        /// complete. 
        /// </summary>
        /// <param name="persister">The persister for which to complete loading. </param>
        public void EndLoadingCollections(ICollectionPersister persister)
        {
            if (!loadContexts.HasLoadingCollectionEntries || (localLoadingCollectionKeys.Count == 0))
            {
                return;
            }

            // in an effort to avoid concurrent-modification-exceptions (from
            // potential recursive calls back through here as a result of the
            // eventual call to PersistentCollection#endRead), we scan the
            // internal loadingCollections map for matches and store those matches
            // in a temp collection.  the temp collection is then used to "drive"
            // the #endRead processing.
            List<CollectionKey> toRemove = new List<CollectionKey>();
            List<LoadingCollectionEntry> matches =new List<LoadingCollectionEntry>();
            foreach (CollectionKey collectionKey in localLoadingCollectionKeys)
            {
                ISessionImplementor session = LoadContext.PersistenceContext.Session;

                LoadingCollectionEntry lce = loadContexts.LocateLoadingCollectionEntry(collectionKey);
                if (lce == null)
                {
                    log.Warn("In CollectionLoadContext#endLoadingCollections, localLoadingCollectionKeys contained [" + collectionKey + "], but no LoadingCollectionEntry was found in loadContexts");
                }
                else if (lce.ResultSet == resultSet && lce.Persister == persister)
                {
                    matches.Add(lce);
                    if (lce.Collection.Owner == null)
                    {
                        session.PersistenceContext.AddUnownedCollection(new CollectionKey(persister, lce.Key, session.EntityMode),
                                                                        lce.Collection);
                    }
                    if (log.IsDebugEnabled)
                    {
                        log.Debug("removing collection load entry [" + lce + "]");
                    }

                    // todo : i'd much rather have this done from #endLoadingCollection(CollectionPersister,LoadingCollectionEntry)...
                    loadContexts.UnregisterLoadingCollectionXRef(collectionKey);
                    toRemove.Add(collectionKey);
                }
            }
            localLoadingCollectionKeys.RemoveAll(toRemove);

            EndLoadingCollections(persister, matches);
            if ((localLoadingCollectionKeys.Count == 0))
            {
                // todo : hack!!!
                // NOTE : here we cleanup the load context when we have no more local
                // LCE entries.  This "works" for the time being because really
                // only the collection load contexts are implemented.  Long term,
                // this cleanup should become part of the "close result set"
                // processing from the (sandbox/jdbc) jdbc-container code.
                loadContexts.Cleanup(resultSet);
            }
        }
开发者ID:zibler,项目名称:zibler,代码行数:62,代码来源:CollectionLoadContext.cs


示例15: ReplaceElements

		public object ReplaceElements(object original, object target, ICollectionPersister persister, object owner, IDictionary copyCache, ISessionImplementor session)
		{
			IDefaultableList result = (IDefaultableList)target;
			result.Clear();
			foreach (object o in (IDefaultableList)original)
			{
				result.Add(o);
			}
			return result;
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:10,代码来源:DefaultableListType.cs


示例16: CollectionRemoveAction

		/// <summary> 
		/// Removes a persistent collection from a specified owner. 
		/// </summary>
		/// <param name="affectedOwner">The collection's owner; must be non-null </param>
		/// <param name="persister"> The collection's persister </param>
		/// <param name="id">The collection key </param>
		/// <param name="emptySnapshot">Indicates if the snapshot is empty </param>
		/// <param name="session">The session </param>
		/// <remarks> Use this constructor when the collection to be removed has not been loaded. </remarks>
		public CollectionRemoveAction(object affectedOwner, ICollectionPersister persister, object id, bool emptySnapshot,
		                              ISessionImplementor session) : base(persister, null, id, session)
		{
			if (affectedOwner == null)
			{
				throw new AssertionFailure("affectedOwner == null");
			}
			this.emptySnapshot = emptySnapshot;
			this.affectedOwner = affectedOwner;
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:19,代码来源:CollectionRemoveAction.cs


示例17: Snapshot

		/// <summary>
		/// Returns a Hashtable where the Key &amp; the Value are both a Copy of the
		/// same object.
		/// <see cref="AbstractPersistentCollection.Snapshot(ICollectionPersister)"/>
		/// </summary>
		/// <param name="persister"></param>
		protected override ICollection Snapshot(ICollectionPersister persister)
		{
			Hashtable clonedMap = new Hashtable(internalSet.Count);
			foreach (object obj in internalSet)
			{
				object copied = persister.ElementType.DeepCopy(obj);
				clonedMap[copied] = copied;
			}
			return clonedMap;
		}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:16,代码来源:PersistentSet.cs


示例18: Snapshot

		/// <summary>
		/// 
		/// </summary>
		/// <param name="persister"></param>
		/// <returns></returns>
		protected override ICollection Snapshot( ICollectionPersister persister )
		{
			SortedList clonedMap = new SortedList( comparer );
			foreach( DictionaryEntry de in map )
			{
				object copy = persister.ElementType.DeepCopy( de.Value );
				clonedMap.Add( de.Key, copy );
			}

			return clonedMap;
		}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:16,代码来源:SortedMap.cs


示例19: ReplaceElements

		public object ReplaceElements(object original, object target, ICollectionPersister persister, object owner,
		                              IDictionary copyCache, ISessionImplementor session)
		{
			IList<Email> result = (IList<Email>) target;
			result.Clear();

			foreach (object o in ((IEnumerable) original))
				result.Add((Email) o);

			return result;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:11,代码来源:MyListType.cs


示例20: GetSnapshot

		public override ICollection GetSnapshot(ICollectionPersister persister)
		{
			EntityMode entityMode = Session.EntityMode;
			Hashtable clonedMap = new Hashtable(map.Count);
			foreach (DictionaryEntry e in map)
			{
				object copy = persister.ElementType.DeepCopy(e.Value, entityMode, persister.Factory);
				clonedMap[e.Key] = copy;
			}
			return clonedMap;
		}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:11,代码来源:PersistentMap.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICollectionView类代码示例发布时间:2022-05-24
下一篇:
C# ICollection类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap