Ejemplo n.º 1
0
        /// <summary>
        /// Update dla sporej liczby danych, typu Bulk, pod spodem tmp table i merge
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entities"></param>
        /// <returns></returns>
        public async Task UpdateBulk <T>(List <T> entities) where T : class
        {
            try
            {
                await _databaseContext.BulkUpdateAsync(entities);

                await _databaseContext.SaveChangesAsync();
            }
            catch
            {
            }
            finally
            {
                Parallel.ForEach(entities, p =>
                {
                    _databaseContext.Entry(p).State = EntityState.Detached;
                });
            }
        }