Exemple #1
0
        /// <summary>
        /// 根据属性查询数据。框架已经给对象的所有属性做了索引。
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="propertyName">属性名称</param>
        /// <param name="val">属性的值</param>
        /// <returns>返回数据列表</returns>
        public static List <CacheObject> findBy(Type t, String propertyName, Object val)
        {
            findAll(t);
            IList list = MemoryDB.FindBy(t, propertyName, val);

            return(db.getResults <CacheObject>(list));
        }
Exemple #2
0
        /// <summary>
        /// 查询类型 T 的所有数据
        /// </summary>
        public static List <CacheObject> findAll(Type t)
        {
            IList list = MemoryDB.FindAll(t);

            return(db.getResults <CacheObject>(list));
        }
Exemple #3
0
 /// <summary>
 /// 根据 id 查询某条数据
 /// </summary>
 public static CacheObject findById(Type t, int id)
 {
     return(MemoryDB.FindById(t, id));
 }
Exemple #4
0
 /// <summary>
 /// 检索出所有对象
 /// </summary>
 /// <returns></returns>
 public IList findAll()
 {
     return(MemoryDB.FindAll(this.GetType()));
 }
Exemple #5
0
 /// <summary>
 /// 根据属性名,检索出对象
 /// </summary>
 /// <param name="propertyName"></param>
 /// <param name="val"></param>
 /// <returns></returns>
 public IList findBy(String propertyName, Object val)
 {
     findAll();
     return(MemoryDB.FindBy(this.GetType(), propertyName, val));
 }
Exemple #6
0
 /// <summary>
 /// 删除数据
 /// </summary>
 public void delete()
 {
     MemoryDB.Delete(this);
 }
Exemple #7
0
 /// <summary>
 /// 根据 id 检索对象
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public CacheObject findById(long id)
 {
     return(MemoryDB.FindById(this.GetType(), id));
 }
Exemple #8
0
 /// <summary>
 /// 更新数据:只针对特性数据做索引
 /// </summary>
 /// <param name="dic"></param>
 public void updateByIndex(Dictionary <String, Object> dic)
 {
     MemoryDB.updateByIndex(this, dic);
 }
Exemple #9
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <returns></returns>
 public Result update()
 {
     return(MemoryDB.Update(this));
 }
Exemple #10
0
 /// <summary>
 /// 插入数据:针对若干属性做索引
 /// </summary>
 /// <param name="dic"></param>
 public void insertByIndex(Dictionary <String, Object> dic)
 {
     MemoryDB.InsertByIndex(this, dic);
 }
Exemple #11
0
 /// <summary>
 /// 插入数据:只针对特定属性做索引,提高速度
 /// </summary>
 /// <param name="propertyName"></param>
 /// <param name="pValue"></param>
 public void insertByIndex(String propertyName, Object pValue)
 {
     MemoryDB.InsertByIndex(this, propertyName, pValue);
 }
Exemple #12
0
 /// <summary>
 /// 插入数据:并对所有属性做索引,速度较慢
 /// </summary>
 public void insert()
 {
     MemoryDB.Insert(this);
 }