collectioncacheentry.cs

来自「NHibernate NET开发者所需的」· CS 代码 · 共 40 行

CS
40
字号
using System;
using NHibernate.Collection;
using NHibernate.Persister.Collection;
using NHibernate.Util;

namespace NHibernate.Cache.Entry
{
	[Serializable]
	public class CollectionCacheEntry
	{
		private readonly object state;

		public CollectionCacheEntry(IPersistentCollection collection, ICollectionPersister persister)
		{
			state = collection.Disassemble(persister);
		}

		internal CollectionCacheEntry(object state)
		{
			this.state = state;
		}

		public virtual object[] State
		{
			get { return (object[])state; }//TODO: assumes all collections disassemble to an array!
		}

		public virtual void Assemble(IPersistentCollection collection, ICollectionPersister persister, object owner)
		{
			collection.InitializeFromCache(persister, state, owner);
			collection.AfterInitialize(persister);
		}

		public override string ToString()
		{
			return "CollectionCacheEntry" + ArrayHelper.ToString(State);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?