using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq.Expressions; using Dapper; namespace VOL.Core.Dapper { public interface ISqlDapper { /// /// var p = new object(); // p.Add("@a", 11); //p.Add("@b", dbType: DbType.Int32, direction: ParameterDirection.Output); //p.Add("@c", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue); // /// /// /// /// /// /// List QueryList(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false) where T : class; T QueryFirst(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false) where T : class; object ExecuteScalar(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false); int ExcuteNonQuery(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false); IDataReader ExecuteReader(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false); SqlMapper.GridReader QueryMultiple(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false); (List, List) QueryMultiple(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false); (List, List, List) QueryMultiple(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false); bool Add(T entity); bool AddRange(IEnumerable entities); bool Update(T entity, Expression> updateFileds = null); bool UpdateRange(IEnumerable entities, Expression> updateFileds = null); bool DelByKey(params object[] keys); /// /// sqlserver批量写入 /// 使用时DataTable table表字段顺序要和数据库字段顺序一致 /// /// mysql批量写入 /// /// /// /// 默认当前下载路径 /// 默认$"{DateTime.Now.ToString("yyyyMMddHHmmss")}.csv" /// int BulkInsert(DataTable table, string tableName, SqlBulkCopyOptions? sqlBulkCopyOptions = null, string fileName = null, string tmpPath = null); /// /// /// /// /// /// /// 所包含的列 /// /// /// /// int BulkInsert(List entities, string tableName = null, Expression> columns = null, SqlBulkCopyOptions? sqlBulkCopyOptions = null); } }