📄 accessorcache.cs
字号:
using System;
using System.Collections;
using Mied.BusinessObject;
namespace Mied.DAL.Accesses
{
public abstract class AccessorCache : AccessorSelect
{
internal AccessorCache(MiedDatabase database, string tableName)
: base(database, tableName)
{
}
public IList SelectListFromCache()
{
this.InitializationCacheList();
IList list = this.CreateEntityList();
foreach (Entity entity in this.CacheList)
list.Add(entity);
return list;
}
public IList CreateCacheList()
{
this.InitializationCacheList();
IList list = this.CreateCacheListObject();
foreach (Entity entity in this.CacheList)
list.Add(entity.Clone());
return list;
}
protected abstract IList CreateCacheListObject();
protected virtual IList GetCacheListSourceList()
{
return this.SelectList();
}
private void InitializationCacheList()
{
if (this.CacheList != null)
return;
this.CacheList = this.CreateCacheListObject();
IList sourceList = this.GetCacheListSourceList();
foreach (Entity entity in sourceList)
this.CacheList.Add(entity);
}
protected override void OnDatabaseClosed()
{
IDisposable disposable = this.CacheList as IDisposable;
if (disposable != null)
disposable.Dispose();
this.CacheList = null;
}
private IList CacheList;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -