/// <summary> /// 更新 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="where">条件表达式 Get(p => p.ID == 100 && p.Name == "hhahh2011") 或者使用Spec</param> /// <param name="select">选择列表达式 Get(p => new Columns(p.ID, p.Name))</param> /// <param name="trans">事务</param> /// <returns>受影响的行数</returns> protected virtual int DMUpdate <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where, Expression <Func <TEntity, Columns> > select, IDbTransaction trans) { return(DMContext.Update <TEntity>(entity, where, select, trans)); }
public virtual int Save <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where, Expression <Func <TEntity, Columns> > select, string connectionString) { return(DMContext.Update <TEntity>(entity, where, select, null, connectionString)); }
public static TService GetService <TService>() where TService : class { return(DMContext.GetService <TService>()); }
public virtual int Remove <TEntity>(Expression <Func <TEntity, bool> > where) { return(DMContext.Delete <TEntity>(where)); }
public virtual int Remove <TEntity>(Expression <Func <TEntity, bool> > where, string connectionString) { return(DMContext.Delete <TEntity>(where, null, connectionString)); }
public virtual TEntity Get <TEntity>(Expression <Func <TEntity, bool> > where, Expression <Func <TEntity, Columns> > select = null, string connectionString = null) { return(DMContext.Query <TEntity>().Where(where).Select(select).SetConnectionString(connectionString).Single()); }
public virtual List <TEntity> GetList <TEntity>(int top, Expression <Func <TEntity, bool> > where = null, Expression <Func <TEntity, Columns> > order = null, Expression <Func <TEntity, Columns> > select = null, string connectionString = null) { return(DMContext.Query <TEntity>().Where(where).OrderBy(order).Select(select).SetConnectionString(connectionString).ToList(top)); }
public int Remove <T>(Expression <Func <T, bool> > where) { return(DMContext.Delete(where, this.trans.BeginTransaction())); }
public int Save <T>(T t, Expression <Func <T, bool> > where, Expression <Func <T, Columns> > select = null) { return(DMContext.Update(t, where, select, this.trans.BeginTransaction())); }
/// <summary> /// 添加 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="select">要插入的列 Add(p => new Columns(p.ID, p.Name)) 不填则为插入所有字段 除主键外</param> /// <returns>如果主键是自增长的话,返回自增长的id 同时item里面的主键也被设置为id</returns> protected virtual int DMInsert <TEntity>(TEntity entity, Expression <Func <TEntity, Columns> > select) { return(DMContext.Insert <TEntity>(entity, select)); }
/// <summary> /// 添加 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="select">要插入的列 Add(p => new Columns(p.ID, p.Name)) 不填则为插入所有字段 除主键外</param> /// <param name="connectionString">自定义数据库连接</param> /// <returns>如果主键是自增长的话,返回自增长的id 同时item里面的主键也被设置为id</returns> protected virtual int DMInsert <TEntity>(TEntity entity, Expression <Func <TEntity, Columns> > select, string connectionString) { return(DMContext.Insert <TEntity>(entity, select, null, connectionString)); }
/// <summary> /// 添加 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="trans">事务</param> /// <returns>如果主键是自增长的话,返回自增长的id 同时item里面的主键也被设置为id</returns> protected virtual int DMInsert <TEntity>(TEntity entity, IDbTransaction trans) { return(DMContext.Insert <TEntity>(entity, null, trans)); }
/// <summary> /// 更新 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="where">条件表达式 Get(p => p.ID == 100 && p.Name == "hhahh2011") 或者使用Spec</param> /// <returns>受影响的行数</returns> protected virtual int DMUpdate <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where) { return(DMContext.Update <TEntity>(entity, where)); }
/// <summary> /// 更新 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="where">条件表达式 Get(p => p.ID == 100 && p.Name == "hhahh2011") 或者使用Spec</param> /// <param name="connectionString">自定义连接</param> /// <returns>受影响的行数</returns> protected virtual int DMUpdate <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where, string connectionString) { return(DMContext.Update <TEntity>(entity, where, null, null, connectionString)); }
public virtual int Add <TEntity>(TEntity t, Expression <Func <TEntity, Columns> > select, string connectionString) { return(DMContext.Insert <TEntity>(t, select, null, connectionString)); }
public int Add <T>(T t, Expression <Func <T, Columns> > select = null) { return(DMContext.Insert(t, select, this.trans.BeginTransaction())); }
public virtual int Add <TEntity>(TEntity t) { return(DMContext.Insert <TEntity>(t)); }
public virtual ATSqlCommand GetTSqlCommand(string cmdText, IList <IDbDataParameter> parameter = null, IDbTransaction trans = null) { return(DMContext.TSqlCommand(cmdText, parameter, trans)); }
public virtual List <TEntity> GetAll <TEntity>(Expression <Func <TEntity, Columns> > order = null, Expression <Func <TEntity, Columns> > select = null, string connectionString = null) { return(DMContext.Query <TEntity>().OrderBy(order).Select(select).SetConnectionString(connectionString).ToList()); }
public virtual int Save <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where) { return(DMContext.Update <TEntity>(entity, where)); }
public virtual PageList <TEntity> GetPageList <TEntity>(int pageIndex, int pageSize, Expression <Func <TEntity, bool> > where = null, Expression <Func <TEntity, Columns> > order = null, Expression <Func <TEntity, Columns> > select = null, string connectionString = null) { return(DMContext.Query <TEntity>().Where(where).OrderBy(order).Select(select).SetConnectionString(connectionString).ToPageList(pageIndex, pageSize)); }
public virtual int Add <TEntity>(TEntity entity, IDbTransaction trans) { return(DMContext.Insert <TEntity>(entity, null, trans)); }
public virtual int Remove <TEntity>(Expression <Func <TEntity, bool> > where, IDbTransaction trans) { return(DMContext.Delete <TEntity>(where, trans)); }
public virtual int Add <TEntity>(TEntity entity, string connectionString) { return(DMContext.Insert <TEntity>(entity, null, null, connectionString)); }
public virtual int Save <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where, IDbTransaction trans) { return(DMContext.Update <TEntity>(entity, where, null, trans)); }
public virtual int Add <TEntity>(TEntity t, Expression <Func <TEntity, Columns> > select, IDbTransaction trans) { return(DMContext.Insert <TEntity>(t, select, trans)); }
public virtual int Save <TEntity>(TEntity entity, Expression <Func <TEntity, bool> > where, Expression <Func <TEntity, Columns> > select) { return(DMContext.Update <TEntity>(entity, where, select)); }
public virtual int Add <TEntity>(TEntity t, Expression <Func <TEntity, Columns> > select) { return(DMContext.Insert <TEntity>(t, select)); }
public static void Register <TService, TImpl>() where TService : class where TImpl : class, TService { DMContext.Register <TService, TImpl>(); }
/// <summary> /// 分页获取记录集合 /// </summary> /// <typeparam name="TEntity">实体类型</typeparam> /// <param name="pageIndex">第几页</param> /// <param name="pageSize">每页大小</param> /// <returns>符合条件的记录集合</returns> protected virtual PageList <TEntity> DMSelectPageList <TEntity>(int pageIndex, int pageSize) { return(DMContext.Query <TEntity>().ToPageList(pageIndex, pageSize)); }