public void SaveEntityByAppID(string appid, dm_basesetting_tipEntity entity) { try { dm_basesetting_tipEntity dm_Basesetting_TipEntity = this.BaseRepository("dm_data").FindEntity <dm_basesetting_tipEntity>(t => t.appid == appid); if (dm_Basesetting_TipEntity.IsEmpty()) { entity.Create(); entity.appid = appid; this.BaseRepository("dm_data").Insert(entity); } else { entity.Modify(dm_Basesetting_TipEntity.id); this.BaseRepository("dm_data").Update(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }
/// <summary> /// 保存实体数据(新增、修改) /// <param name="keyValue">主键</param> /// <summary> /// <returns></returns> public void SaveEntity(int keyValue, dm_basesetting_tipEntity entity) { try { if (keyValue > 0) { entity.Modify(keyValue); this.BaseRepository("dm_data").Update(entity); } else { entity.Create(); this.BaseRepository("dm_data").Insert(entity); } } catch (Exception ex) { if (ex is ExceptionEx) { throw; } else { throw ExceptionEx.ThrowServiceException(ex); } } }