public static void TryUpdateManyToMany <T, TKey>(this FutrueContext db, IEnumerable <T> currentItems, IEnumerable <T> newItems, Func <T, TKey> getKey) where T : class { db.Set <T>().RemoveRange(currentItems.Except(newItems, getKey)); db.Set <T>().AddRange(newItems.Except(currentItems, getKey)); }
public PermissionRepository(IMapper mapper, FutrueContext context) { _mapper = mapper ?? throw new ArgumentException(nameof(mapper)); _context = context ?? throw new ArgumentException(nameof(mapper)); }