Exemple #1
0
 /// <summary>
 /// 创建
 /// </summary>
 /// <param name="db">实体数据</param>
 /// <param name="entity">将要创建的对象</param>
 public virtual void Create(SysEntities db, T entity)
 {
     if (entity != null)
     {
         db.CreateObjectSet <T>().AddObject(entity);
     }
 }
Exemple #2
0
 /// <summary>
 /// 获取所有
 /// </summary>
 /// <returns>集合</returns>
 public virtual IQueryable <T> GetAll(SysEntities db)
 {
     return(db.CreateObjectSet <T>().AsQueryable());
 }
Exemple #3
0
 /// <summary>
 /// 编辑一个对象
 /// </summary>
 /// <param name="db">实体数据</param>
 /// <param name="entity">将要编辑的一个对象</param>
 public virtual T Edit(SysEntities db, T entity)
 {
     db.CreateObjectSet <T>().Attach(entity);
     db.ObjectStateManager.ChangeObjectState(entity, EntityState.Modified);
     return(entity);
 }