示例#1
0
 /// <summary>
 /// 异步批量增加
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="entity"></param>
 /// <returns></returns>
 public async Task <int> AddEntityListAsync <T>(List <T> entityList) where T : class
 {
     entityList.ForEach(async e =>
     {
         await EfdDbContext.Set <T>().AddAsync(e);
     });
     return(await EfdDbContext.SaveChangesAsync());
 }
示例#2
0
        /// <summary>
        /// 异步新增
        /// </summary>
        /// <typeparam name="T">类型</typeparam>
        /// <param name="entity">实体</param>
        /// <returns></returns>
        public async Task <int> AddEntityAsync <T>(T entity) where T : class
        {
            await EfdDbContext.Set <T>().AddAsync(entity);

            return(await EfdDbContext.SaveChangesAsync());
        }