/// <summary> /// 更新一条数据 /// </summary> public virtual void Update(Organization_type model) { using (var session = sessionFactory.OpenSession()) { session.SaveOrUpdate(model); session.Flush(); } }
/// <summary> /// 增加一条数据 /// </summary> public virtual object Save(Organization_type model) { using (ISession session = sessionFactory.OpenSession()) { var id = session.Save(model); session.Flush(); return(id); } }
/// <summary> /// 删除数据 /// </summary> public override void Delete(Organization_type model) { string key = "Organization_type:" + model.id; if (rh.Exist(key) > 0) //存在 { rh.Remove(key); //检查是否存在关联 rh.DelJoin("Organization_type"); } base.Delete(model); }
/// <summary> /// 更新一条数据 /// </summary> public override void Update(Organization_type model) { string key = "Organization_type:" + model.id; if (rh.Exist(key) > 0) //存在 { //修改当前集合 rh.Set <Organization_type>(key, model); //检查是否存在关联 rh.DelJoin("Organization_type"); } base.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public override object Save(Organization_type model) { var res = base.Save(model); if ((int)res > 0) { string key = "Organization_type:" + res; if (rh.Exist(key) <= 0) //不存在 { rh.Set <Organization_type>(key, model); //检查是否存在关联 rh.DelJoin("Organization_type"); } } return(res); }