public async Task <int> InsertAsync(LangDictionary model, IDbTransaction trans, IDbConnection conn) { string sql = "INSERT INTO langDictionary (dicKey,lang,dicValue) VALUES (@DicKey,@Lang,@DicValue);"; if (trans == null) { return(await conn.ExecuteAsync(sql, param : model, commandType : CommandType.Text)); } else { return(await conn.ExecuteAsync(sql, param : model, commandType : CommandType.Text, transaction : trans)); } }
public async Task <int> UpdateAsync(LangDictionary model, IDbTransaction trans, IDbConnection conn) { string sql = "UPDATE langDictionary SET dicValue=@DicValue WHERE 1=1 AND dicKey=@DicKey AND lang=@Lang"; if (trans == null) { return(await conn.ExecuteAsync(sql, param : model, commandType : CommandType.Text)); } else { return(await conn.ExecuteAsync(sql, param : model, commandType : CommandType.Text, transaction : trans)); } }
public async Task <int> InsertUpdateAsync(LangDictionary model, IDbTransaction trans, IDbConnection conn) { string sql = "UPDATE langDictionary SET dicValue=@DicValue WHERE 1=1 AND dicKey=@DicKey AND lang=@Lang;INSERT INTO langDictionary (dicKey,lang,dicValue) SELECT @DicKey,@Lang,@DicValue WHERE NOT EXISTS (SELECT 1 FROM langDictionary where 1=1 AND dicKey=@DicKey AND lang=@Lang)"; if (trans == null) { return(await conn.ExecuteAsync(sql, param : model, commandType : CommandType.Text)); } else { return(await conn.ExecuteAsync(sql, param : model, commandType : CommandType.Text, transaction : trans)); } }
public async Task <int> InsertAsync(LangDictionary model) { using Connector conn = ConnectionProvider.GetConnection(); return(await InsertAsync(model, null, conn.Connection)); }
public int Insert(LangDictionary model) { using Connector conn = ConnectionProvider.GetConnection(); return(Insert(model, null, conn.Connection)); }
public int Update(LangDictionary model) { using Connector conn = ConnectionProvider.GetConnection(); return(Update(model, null, conn.Connection)); }