entityboundcollection.cs

来自「用于c#.net数据库操作的类库。能把结婚集以数组的形成操作。」· CS 代码 · 共 121 行

CS
121
字号
using System;
using System.Collections;

namespace EnterpriseObjects
{
	/// <summary>
	/// Summary description for EntityBoundCollection.
	/// </summary>
	public class EntityBoundCollection : IList
	{
		// members...
		public EntitySet EntitySet;
		public int TableIndex;
												   
		public EntityBoundCollection()
		{
		}

		public class EntityBoundCollectionCannotBeChangedException : ApplicationException
		{
		}

		public int Add(object val)
		{
			throw new EntityBoundCollectionCannotBeChangedException();
		}

		public void Clear()
		{
			throw new EntityBoundCollectionCannotBeChangedException();
		}

		public bool Contains(object val)
		{
			throw new NotImplementedException();
		}

		public void CopyTo(Array array, int index)
		{
			throw new NotImplementedException();
		}

		public int Count
		{
			get
			{
				return EntitySet.GetCount(TableIndex);
			}
		}

		public IEnumerator GetEnumerator()
		{
			return EntitySet.GetEnumerator(TableIndex);
		}

		public int IndexOf(object val)
		{
			throw new NotImplementedException();
		}

		public void Insert(int index, object val)
		{
			throw new EntityBoundCollectionCannotBeChangedException();
		}

		public bool IsFixedSize
		{
			get
			{
				return true;
			}
		}

		public bool IsReadOnly
		{
			get
			{
				return true;
			}
		}

		public bool IsSynchronized
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		public object this[int index]
		{
			get
			{
				return EntitySet.GetEntity(TableIndex, index);
			}
			set
			{
				throw new EntityBoundCollectionCannotBeChangedException();
			}
		}

		public void Remove(object val)
		{
			throw new EntityBoundCollectionCannotBeChangedException();
		}

		public void RemoveAt(int index)
		{
			throw new EntityBoundCollectionCannotBeChangedException();
		}

		public object SyncRoot
		{
			get
			{
				throw new NotImplementedException();
			}
		}
	}
}

⌨️ 快捷键说明

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