/// <summary> /// 根据数据字典编码查询数据字典子项列表 /// </summary> /// <param name="dataDictionaryCode">数据字典编码</param> /// <param name="connectionId">连接ID</param> /// <returns>数据字典子项列表</returns> public IList <DataDictionaryItemInfo> SelectByDataDictionaryCode(string dataDictionaryCode, string connectionId = null) { IList <DataDictionaryItemInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{SelectSql("DDI.")} INNER JOIN data_dictionary DD" + $" ON DD.id=DDI.data_dictionary_id AND DD.code=@DataDictionaryCode"; result = dbConn.Query <DataDictionaryItemInfo>(sql, new { DataDictionaryCode = dataDictionaryCode }).AsList(); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据用户ID删除 /// </summary> /// <param name="userId">用户ID</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int DeleteByUserId(int userId, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicDeleteSql()} WHERE {GetFieldByProp("UserId")}=@UserId"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "DeleteByUserId"); result = dbConn.Execute(sql, new { UserId = userId }, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据角色ID查询用户列表 /// </summary> /// <param name="roleId">角色ID</param> /// <param name="connectionId">连接ID</param> /// <returns>用户列表</returns> public IList <UserInfo> SelectUsersByRoleId(int roleId, string connectionId = null) { IList <UserInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"SELECT {UserPersistence.AllFieldMapProps().JoinSelectPropMapFields("U.")} FROM [{UserPersistence.Table}] U" + $" INNER JOIN [{Table}] UR ON U.id=UR.user_id AND UR.role_id=@RoleId AND U.system_hide=@SystemHide"; result = dbConn.Query <UserInfo>(sql, new { RoleId = roleId, SystemHide = false }).AsList(); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据工作流ID更新处理状态为已失效但排除ID /// </summary> /// <param name="workflowHandle">工作流处理</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int UpdateEfficacyedNotIdByWorkflowId(WorkflowHandleInfo workflowHandle, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"UPDATE `{Table}` SET `{GetFieldByProp("HandleStatus")}`={(byte)HandleStatusEnum.EFFICACYED},`{GetFieldByProp("HandleTime")}`=@HandleTime" + $"{GetModifyInfoSql(workflowHandle)} WHERE {GetFieldByProp("Id") }!=@Id AND {GetFieldByProp("WorkflowId") }=@WorkflowId AND {GetFieldByProp("HandleStatus") }={(byte)HandleStatusEnum.UN_HANDLE} AND {GetFieldByProp("HandleType")}={(byte)HandleTypeEnum.AUDIT}"; result = dbConn.Execute(sql, workflowHandle, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据用户ID删除 /// </summary> /// <param name="roleId">角色ID</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int DeleteByRoleId(int roleId, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { var sql = DeleteSql(); Log.TraceAsync(sql, source: this.GetType().Name, tags: "DeleteByRoleId"); result = dbConn.Execute($"{sql} WHERE role_id=@RoleId", new { RoleId = roleId }, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据用户ID查询角色列表 /// </summary> /// <param name="userId">用户ID</param> /// <param name="connectionId">连接ID</param> /// <returns>角色列表</returns> public IList <RoleInfo> SelectRolesByUserId(int userId, string connectionId = null) { IList <RoleInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"SELECT {RolePersistence.AllFieldMapProps().JoinSelectPropMapFields("R.")} FROM [{RolePersistence.Table}] R" + $" INNER JOIN [{Table}] UR ON R.id=UR.role_id AND UR.user_id=@UserId"; result = dbConn.Query <RoleInfo>(sql, new { UserId = userId }).AsList(); }, AccessMode.SLAVE); return(result); }
public object ExecuteScalar() { object result = null; using (var conn = DbConnectionManager.Clone()) { conn.Open(); QueryStart(); result = conn.ExecuteScalar(Command, _Parameter); QueryFinish(); } return(result); }
/// <summary> /// 根据ID更新增量 /// </summary> /// <param name="sequenceInfo">序列信息</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int UpdateIncrementById(SequenceInfo sequenceInfo, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"UPDATE `{Table}` SET `{GetFieldByProp("Increment")}`=@Increment,`{GetFieldByProp("UpdateDate")}`=@UpdateDate{GetModifyInfoSql(sequenceInfo)} WHERE {GetFieldByProp("Id") }=@Id"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "UpdateIncrementById"); result = dbConn.Execute(sql, sequenceInfo, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据登录ID和密码查询用户信息 /// </summary> /// <param name="loginId">登录ID</param> /// <param name="password">密码</param> /// <param name="connectionId">连接ID</param> /// <returns>用户信息</returns> public UserInfo SelectByLoginIdAndPassword(string loginId, string password, string connectionId = null) { UserInfo result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE {GetFieldByProp("LoginId")}=@LoginId AND `{GetFieldByProp("Password")}`=@Password"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectByLoginIdAndPassword"); result = dbConn.QueryFirstOrDefault <UserInfo>(sql, new { LoginId = loginId, Password = password }); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据登录ID或编码或名称查询用户信息,但排除ID /// </summary> /// <param name="notId">排除ID</param> /// <param name="loginId">登录ID</param> /// <param name="code">编码</param> /// <param name="name">名称</param> /// <param name="connectionId">连接ID</param> /// <returns>用户信息</returns> public UserInfo SelectByLoginIdOrCodeOrNameNotId(int notId, string loginId, string code, string name, string connectionId = null) { UserInfo result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE `{GetFieldByProp("Id")}`!=@Id AND (`{GetFieldByProp("LoginId")}`=@LoginId OR `{GetFieldByProp("Code")}`=@Code OR `{GetFieldByProp("Name")}`=@Name)"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectByLoginIdOrCodeOrNameNotId"); result = dbConn.QueryFirstOrDefault <UserInfo>(sql, new { Id = notId, LoginId = loginId, Code = code, Name = name }); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据编码或名称查询角色列表,但排除ID /// </summary> /// <param name="code">编码</param> /// <param name="name">名称</param> /// <param name="notId">排除ID</param> /// <param name="connectionId">连接ID</param> /// <returns>角色列表</returns> public IList <RoleInfo> SelelctByCodeOrNameNotId(string code, string name, int notId, string connectionId = null) { IList <RoleInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE Id!=@Id AND (`{GetFieldByProp("Code")}`=@Code OR `{GetFieldByProp("Name")}`=@Name)"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelelctByCodeOrNameNotId"); result = dbConn.Query <RoleInfo>(sql, new { Id = notId, Code = code, Name = name }).AsList(); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 查询角色列表并去掉系统隐藏 /// </summary> /// <param name="connectionId">连接ID</param> /// <returns>角色列表</returns> public IList <RoleInfo> SelectAndNotSystemHide(string connectionId = null) { IList <RoleInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE {GetFieldByProp("SystemHide")}=@SystemHide"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectAndNotSystemHide"); result = dbConn.Query <RoleInfo>(sql, new { SystemHide = false }).AsList(); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据工作流ID和处理状态统计个数但排除流程关卡ID /// </summary> /// <param name="workflowId">工作流ID</param> /// <param name="handleStatus">处理状态</param> /// <param name="notFlowCensorshipId">排除流程关卡ID</param> /// <param name="connectionId">连接ID</param> /// <returns>个数</returns> public int CountNotFlowCensorshipIdByWorkflowIdAndHandleStatus(int workflowId, HandleStatusEnum handleStatus, int notFlowCensorshipId, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicCountSql()} WHERE {GetFieldByProp("WorkflowId")}=@WorkflowId AND {GetFieldByProp("HandleStatus")}=@handleStatus AND {GetFieldByProp("FlowCensorshipId")}!=@NotFlowCensorshipId"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "CountNotFlowCensorshipIdByWorkflowIdAndHandleStatus"); result = dbConn.ExecuteScalar <int>(sql, new { WorkflowId = workflowId, HandleStatus = (byte)handleStatus, NotFlowCensorshipId = notFlowCensorshipId }, GetDbTransaction(connId)); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据数据字典ID和文本统计个数,但排除ID /// </summary> /// <param name="notId">排除ID</param> /// <param name="dataDictionaryId">数据字典ID</param> /// <param name="text">文本</param> /// <param name="connectionId">连接ID</param> /// <returns>个数</returns> public int CountByDataItemIdAndTextNotId(int notId, int dataDictionaryId, string text, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicCountSql()} WHERE `{GetFieldByProp("Id")}`!=@Id AND {GetFieldByProp("DataDictionaryId")}=@DataDictionaryId AND `{GetFieldByProp("Text")}`=@Text"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "CountByDataItemIdAndTextNotId"); result = dbConn.ExecuteScalar <int>(sql, new { Id = notId, DataDictionaryId = dataDictionaryId, Text = text }); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据ID更新是否已读 /// </summary> /// <param name="workflowHandle">工作流处理</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int UpdateIsReadedById(WorkflowHandleInfo workflowHandle, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"UPDATE `{Table}` SET `{GetFieldByProp("IsReaded")}`=@IsReaded{GetModifyInfoSql(workflowHandle)} WHERE {GetFieldByProp("Id") }=@Id"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "UpdateIsReadedById"); result = dbConn.Execute(sql, workflowHandle, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据处理人ID统计审核且未处理的个数 /// </summary> /// <param name="handlerId">处理人ID</param> /// <param name="connectionId">连接ID</param> /// <returns>审核中且未处理的个数</returns> public int CountAuditAndUnhandleByHandleId(int handlerId, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicCountSql()} WHERE {GetFieldByProp("HandlerId")}=@HandlerId AND {GetFieldByProp("HandleStatus")}=@handleStatus AND {GetFieldByProp("HandleType")}=@HandleType"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "CountAuditAndUnhandleByHandleId"); result = dbConn.ExecuteScalar <int>(sql, new { HandlerId = handlerId, HandleStatus = (byte)HandleStatusEnum.UN_HANDLE, HandleType = (byte)HandleTypeEnum.AUDIT }, GetDbTransaction(connId)); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据ID更新处理状态 /// </summary> /// <param name="workflowHandle">工作流处理</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int UpdateHandleStatusById(WorkflowHandleInfo workflowHandle, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"UPDATE `{Table}` SET `{GetFieldByProp("HandleStatus")}`=@HandleStatus,`{GetFieldByProp("HandleTime")}`=@HandleTime,`{GetFieldByProp("Idea")}`=@Idea" + $"{GetModifyInfoSql(workflowHandle)} WHERE {GetFieldByProp("Id") }=@Id"; result = dbConn.Execute(sql, workflowHandle, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据归属删除 /// </summary> /// <param name="ownerType">归属类型</param> /// <param name="ownerId">归属ID</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int DeleteByOwner(short ownerType, int ownerId, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicDeleteSql()} WHERE owner_type=@OwnerType AND owner_id=@OwnerId"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "DeleteByOwner"); result = dbConn.Execute(sql, new { OwnerType = ownerType, OwnerId = ownerId }, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据数据字典子项ID查询数据字典子项扩展列表 /// </summary> /// <param name="dataDictionaryItemId">数据字典子项ID</param> /// <param name="connectionId">连接ID</param> /// <returns>数据字典子项扩展列表</returns> public IList <DataDictionaryItemExpandInfo> SelectByDataDictionaryItemId(int dataDictionaryItemId, string connectionId = null) { IList <DataDictionaryItemExpandInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE {GetFieldByProp("DataDictionaryItemId")}=@DataDictionaryItemId"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectByDataDictionaryItemId"); result = dbConn.Query <DataDictionaryItemExpandInfo>(sql, new { DataDictionaryItemId = dataDictionaryItemId }).AsList(); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 异步执行 /// </summary> /// <typeparam name="TResult">结果类型</typeparam> /// <param name="connectionId">连接ID</param> /// <param name="isClose">是否关闭</param> /// <param name="dbConnection">数据库连接</param> /// <param name="func">函数</param> /// <returns>结果任务</returns> protected async Task <TResult> ExecAsync <TResult>(string connectionId, bool isClose, IDbConnection dbConnection, Func <TResult> func) { return(await Task.Run <TResult>(() => { TResult result = func(); if (isClose) { DbConnectionManager.Release(connectionId, dbConnection); } return result; })); }
public void BulkInsert(ITableData data, string tableName) { using (var conn = DbConnectionManager.Clone()) { conn.Open(); QueryStart(LogType.Bulk); conn.BeforeBulkInsert(); conn.BulkInsert(data, tableName); conn.AfterBulkInsert(); RowsAffected = data.RecordsAffected; QueryFinish(LogType.Rows); } }
/// <summary> /// 根据ID更新密码 /// </summary> /// <param name="user">用户</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数</returns> public int UpdatePasswordById(UserInfo user, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"UPDATE `{Table}` SET `{GetFieldByProp("Password")}`=@Password{GetModifyInfoSql(user)} WHERE {GetFieldByProp("Id") }=@Id"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "UpdatePasswordById"); result = dbConn.Execute(sql, user, GetDbTransaction(connId)); }); return(result); }
/// <summary> /// 根据申请单号统计记录数 /// </summary> /// <param name="applyNo">申请单号</param> /// <param name="connectionId">连接ID</param> /// <returns>记录数</returns> public int CountByApplyNo(string applyNo, string connectionId = null) { int result = 0; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicCountSql()} WHERE {GetFieldByProp("ApplyNo")}=@ApplyNo"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "CountByApplyNo"); result = dbConn.ExecuteScalar <int>(sql, new { ApplyNo = applyNo }); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据流程关卡ID查询退件流程路线列表 /// </summary> /// <param name="flowCensorshipId">流程关卡ID</param> /// <param name="connectionId">连接ID</param> /// <returns>退件流程路线列表</returns> public IList <ReturnFlowRouteInfo> SelectByFlowCensorshipId(int flowCensorshipId, string connectionId = null) { IList <ReturnFlowRouteInfo> result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE {GetFieldByProp("FlowCensorshipId")}=@FlowCensorshipId"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectByFlowCensorshipId"); result = dbConn.Query <ReturnFlowRouteInfo>(sql, new { FlowCensorshipId = flowCensorshipId }).AsList(); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据编码查询工作流定义信息 /// </summary> /// <param name="code">编码</param> /// <param name="connectionId">连接ID</param> /// <returns>工作流定义信息</returns> public WorkflowDefineInfo SelectByCode(string code, string connectionId = null) { WorkflowDefineInfo result = null; DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = $"{BasicSelectSql()} WHERE {GetFieldByProp("Code")}=@Code"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectByCode"); result = dbConn.QueryFirstOrDefault <WorkflowDefineInfo>(sql, new { Code = code }); }, AccessMode.SLAVE); return(result); }
/// <summary> /// 根据角色ID集合查询具有权限的菜单列表 /// </summary> /// <param name="roleIds">角色ID集合</param> /// <param name="connectionId">连接ID</param> /// <returns>菜单列表</returns> public IList <MenuInfo> SelectByRoleIds(int[] roleIds, string connectionId = null) { string menuFields = JoinSelectPropMapFields(pfx: "M."); DynamicParameters parameters = new DynamicParameters(); StringBuilder roleSql = new StringBuilder(); for (var i = 0; i < roleIds.Length; i++) { string name = $"@RoleId{i}"; roleSql.AppendFormat("{0},", name); parameters.Add(name, roleIds[i]);; } roleSql.Remove(roleSql.Length - 1, 1); List <MenuInfo> result = new List <MenuInfo>(); DbConnectionManager.BrainpowerExecute(connectionId, this, (connId, dbConn) => { string sql = "SELECT " + menuFields + ", F.id, F.[code], F.[name] FROM menu M" + " INNER JOIN menu_function MF ON M.[Id]=MF.[menu_id]" + " INNER JOIN [function] F ON MF.[function_id]=F.[Id]" + $" INNER JOIN role_menu_function MFU ON MFU.[menu_function_id]= MF.[Id] AND MFU.[role_id] IN({roleSql.ToString()})"; Log.TraceAsync(sql, source: this.GetType().Name, tags: "SelectByRoleIds"); dbConn.Query <MenuInfo, FunctionInfo, MenuInfo>(sql, (x, y) => { MenuInfo existsMenu = result.Find(q => q.Id == x.Id); if (existsMenu == null) { result.Add(x); existsMenu = x; existsMenu.Functions = new List <FunctionInfo>(); existsMenu.Functions.Add(y); return(existsMenu); } List <FunctionInfo> existsFuns = existsMenu.Functions as List <FunctionInfo>; if (existsFuns.Exists(q => q.Id == y.Id)) { return(null); } existsMenu.Functions.Add(y); return(null); }, parameters, splitOn: "Id").AsList(); }, AccessMode.SLAVE); return(result); }
static void TestDbContext() { try { WriteToDatabase(); } catch (Exception ex) { var a = ex; } void WriteToDatabase() { var dbConnectionBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder(); dbConnectionBuilder.DataSource = "115.159.55.137,1999"; dbConnectionBuilder.UserID = "chenguangxu"; dbConnectionBuilder.Password = "******"; dbConnectionBuilder.InitialCatalog = "Manager.Account"; dbConnectionBuilder.ConnectTimeout = 10; DbConnectionManager.Register(dbConnectionBuilder.InitialCatalog, new MsSqlConnectionProvider(10, dbConnectionBuilder.ConnectionString)); EntitySchemaManager.LoadEntity(typeof(Entity)); var option = new DbContextOptions(); option.ExceptionHandling = ExceptionHandling.Skip; using (var dbContext = new DbContext(option)) { var dbSet = dbContext.Set <Entity>(); dbSet.Add(new Entity() { ID = 2, Name = "a2" }); dbSet.Add(new Entity() { ID = 3, Name = "a3" }); try { dbContext.SaveChanges(); } finally { foreach (var row in dbSet.RowEntries) { var a = row.State; } } } } }
/// <summary> /// 异步根据ID集合查询模型 /// </summary> /// <param name="ids">ID集合</param> /// <param name="propertyNames">属性名称集合</param> /// <param name="connectionId">连接ID</param> /// <returns>模型任务</returns> public virtual Task <IList <ModelT> > SelectAsync(IdT[] ids, string[] propertyNames, ref string connectionId) { Task <IList <ModelT> > task = null; DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) => { task = ExecAsync <IList <ModelT> >(connId, isClose, dbConn, () => { return(Select(ids, dbConn, propertyNames: propertyNames)); }); }); return(task); }
/// <summary> /// 异步删除所有模型 /// </summary> /// <param name="connectionId">连接ID</param> /// <returns>影响行数任务</returns> public virtual Task <int> DeleteAsync(ref string connectionId) { Task <int> task = null; DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) => { task = ExecAsync <int>(connId, isClose, dbConn, () => { return(Delete(dbConn)); }); }); return(task); }
/// <summary> /// 异步根据ID更新模型 /// </summary> /// <param name="model">模型</param> /// <param name="propertyNames">属性名称集合</param> /// <param name="connectionId">连接ID</param> /// <returns>影响行数任务</returns> public virtual Task <int> UpdateByIdAsync(ModelT model, string[] propertyNames, ref string connectionId) { Task <int> task = null; DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) => { task = ExecAsync <int>(connId, isClose, dbConn, () => { return(UpdateById(model, dbConn, propertyNames: propertyNames)); }); }); return(task); }
protected override IDisposableDbCommandBuilder GetDbCommandBuilder() { var connectionManager = new DbConnectionManager<SqlCeConnection>(DbConnections.SqlCeConnectionString); return new DisposableDbCommandBuilder<SqlCeConnection>(connectionManager, new SqlCeDbCommandBuilder(connectionManager)); }
protected override IDbCommandBuilder CreateDbCommandBuilder(DbConnectionManager<SqlCeConnection> connectionManager ) { return _mockDbCommandBuilder; }
protected override IDisposableDbCommandBuilder GetDbCommandBuilder() { var connectionManager = new DbConnectionManager<NpgsqlConnection>(DbConnections.PostgresqlConnectionString); return new DisposableDbCommandBuilder<NpgsqlConnection>(connectionManager, new PostgresqlDbCommandBuilder(connectionManager)); }
protected override IDisposableDbCommandBuilder GetDbCommandBuilder() { var connectionManager = new DbConnectionManager<OracleConnection>(DbConnections.OracleClientConnectionString); return new DisposableDbCommandBuilder<OracleConnection>(connectionManager, new OracleClientDbCommandBuilder(connectionManager)); }