Exemple #1
0
        public virtual List <T> Add(List <T> entitiesToAdd)
        {
            _permissionService.Add();

            EntityExtensions.SetDefaultValuesOnEntities(entitiesToAdd);

            using (var context = _contextFactory.Create())
            {
                var dbSet = context.Set <T>();
                dbSet.AddRange(entitiesToAdd);

                try
                {
                    context.SaveChanges();
                }
                catch (DbEntityValidationException exception)
                {
                    WrapValidationException(exception);
                }
            }

            return(entitiesToAdd);
        }