/// <summary> /// 更新实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Update(TEntity entity, bool isSave = true) { PublicHelper.CheckArgument(entity, "entity"); EFContext.RegisterModified <TEntity, TKey>(entity); return(isSave ? EFContext.Commit() : 0); }
/// <summary> /// 更新实体记录 /// </summary> /// <param name="entities"> 实体对象 </param> /// <param name="properties">需部分更新的属性值名称</param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Modify(IEnumerable <T> entities, string[] properties = null, bool isSave = true) { EFContext.RegisterModified(entities, properties); return(isSave ? EFContext.Commit() : 0); }
/// <summary> /// 删除实体记录集合 /// </summary> /// <param name="entities"> 实体记录集合 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Delete(IEnumerable <TEntity> entities, bool isSave = true) { PublicHelper.CheckArgument(entities, "entities"); EFContext.RegisterDeleted <TEntity, TKey>(entities); return(isSave ? EFContext.Commit() : 0); }
/// <summary> /// 更新实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual bool Modify(T entity, bool isSave = true) { EFContext.RegisterModified(entity); return(isSave && EFContext.Commit() > 0); }
/// <summary> /// 更新实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="properties">需部分更新的属性值名称</param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual bool Modify(T entity, string[] properties, bool isSave = true) { EFContext.RegisterModified(entity, properties); return(isSave && EFContext.Commit() > 0); }
/// <summary> /// 删除实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual bool Remove(T entity, bool isSave = true) { EFContext.RegisterDeleted(entity); return(isSave && EFContext.Commit() > 0); }
/// <summary> /// 删除实体记录集合 /// </summary> /// <param name="entities"> 实体记录集合 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Remove(IEnumerable <T> entities, bool isSave = true) { EFContext.RegisterDeleted(entities); return(isSave ? EFContext.Commit() : 0); }
/// <summary> /// 插入实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual bool Add(T entity, bool isSave = true) { EFContext.RegisterNew(entity); return(isSave ? EFContext.Commit() > 0 : false); }
/// <summary> /// 批量插入实体记录集合 /// </summary> /// <param name="entities"> 实体记录集合 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Add(IEnumerable <T> entities, bool isSave = true) { EFContext.RegisterNew(entities); return(isSave ? EFContext.Commit() : 0); }
/// <summary> /// 批量插入实体记录集合 /// </summary> /// <param name="entities"> 实体记录集合 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Insert(IEnumerable <TEntity> entities, bool isSave = true) { PublicHelper.CheckArgument(entities, "entities"); EFContext.RegisterNew(entities); return(isSave ? EFContext.Commit() : 0); }
/// <summary> /// 删除实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Delete(TEntity entity, bool isSave = true) { PublicHelper.CheckArgument(entity, "entity"); EFContext.RegisterDeleted(entity); return(isSave ? EFContext.Commit() : 0); }
/// <summary> ///插入实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Insert(TEntity entity, bool isSave = true) { EFContext.RegisterNew(entity); return(isSave ? EFContext.Commit() : 0); }
public virtual int Update(IEnumerable <TEntity> entityList, bool isSave = true) { EFContext.RegisterModified(entityList); return(isSave ? EFContext.Commit() : 0); }
/// <summary> ///更新实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Update(TEntity entity, bool isSave = true) { EFContext.RegisterModified(entity); return(isSave ? EFContext.Commit() : 0); }
/// <summary> ///删除实体记录 /// </summary> /// <param name="entity"> 实体对象 </param> /// <param name="isSave"> 是否执行保存 </param> /// <returns> 操作影响的行数 </returns> public virtual int Delete(TEntity entity, bool isSave = true) { EFContext.RegisterDeleted(entity); return(isSave ? EFContext.Commit() : 0); }
public int Insert(IEquatable <T> entities, bool isCommit = true) { EFContext.RegisterNew(entities); return(isCommit ? EFContext.Commit() : 0); }