Ejemplo n.º 1
0
        /// <summary>
        /// 批量插入,不建议使用List插入、性能会受一定影响
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="context">当前DbContext</param>
        /// <param name="tableName">要插入的表名称</param>
        /// <param name="list">List列明必须与数据表列一致,严格大小写区分</param>
        public static int BulkInsert <T>(this MySqlDbContext context, string tableName, IList <T> list)
        {
            var provider = new BulkInsertmmMySqlProvider(context);
            var result   = provider.BulkInsert(tableName, list);

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 批量插入
        /// </summary>
        /// <param name="context">当前DbContext</param>
        /// <param name="tableName">要插入的表名称</param>
        /// <param name="dataTable">DataTable</param>
        public static int BulkInsert(this MySqlDbContext context, string tableName, DataTable dataTable)
        {
            var provider = new BulkInsertmmMySqlProvider(context);
            var result   = provider.BulkInsert(tableName, dataTable);

            return(result);
        }