/// <summary> /// /// </summary> /// <param name="item"></param> public virtual void Save(T item) { if (item != null) { unitOfWork.SetAdded(item); // add new item in this set } unitOfWork.Commit(); }
public void Add(TEntity entity) { if (entity != null) { var item = unitOfWork.GetSet <TEntity, TId>(); item.Add(entity); unitOfWork.Commit(); } }
public void Add(TEntity entity) { if (entity == null) { throw new ArgumentException("The Entity Object can not be null"); } var item = unitOfWork.GetSet <TEntity>(); item.Add(entity); unitOfWork.Commit(); }
/// <summary> /// insert new user /// </summary> /// <param name="userDto"></param> /// <returns></returns> public bool InsertUser(UserDTO userDto) { var user = UserAdapter.AdaptToUser(userDto); using (_queryableUnitOfWork) { _userRepository.Add(user); _queryableUnitOfWork.Commit(); } return(true); }
public void Salvar(TEntity entity) { if (entity.Id == default) { GetSet().Add(entity); } else { UnitOfWork.SetModified(entity); } UnitOfWork.Commit(); }
/// <summary> /// 提交 /// </summary> public virtual bool Save() { try { _UnitOfWork.Commit(); return(true); } catch (Exception ex) { return(HandleException <bool>(string.Format("提交({0})出错" + ex.Message, EntityName), ex)); } }
/// <summary> /// <see cref="Microsoft.Samples.NLayerApp.Domain.Seedwork.IRepository{TValueObject}"/> /// </summary> /// <param name="item"><see cref="Microsoft.Samples.NLayerApp.Domain.Seedwork.IRepository{TValueObject}"/></param> public virtual void Modify(TEntity item) { if (item != (TEntity)null) { _UnitOfWork.SetModified(item); _UnitOfWork.Commit(); } else { //LoggerFactory.CreateLog() // .LogInfo(Messages.info_CannotModifyNullEntity, typeof(TEntity).ToString()); } }
public virtual void Add(TEntity item) { _tracer.LogInfo("Add called"); //check item if (item == (TEntity)null) { throw new ArgumentNullException("item", "Argument is null"); } IDbSet <TEntity> objectSet = CreateSet(); objectSet.Add(item); _unitOfWork.Commit(); }
public virtual void Commit() { _UnitOfWork.Commit(); }
public void SaveChage() { _UnitOfWork.Commit(); }
public void Add(T item) { GetSet().Add(item); // add new item in this set _unitOfWork.Commit(); }