why does entity framework saves only the last item of a list?
问题 I have 2 objects with one to many relation. I'm trying to add multiple ProductImages with the same ProductId to the data base, while using a generic repository. I have tried saving a list of ProductImage to a repository with dbSet.AddRange . after that i saved it with context.SaveChanges(); i have also tried looping trough the list of ProductImage and adding each item with dbSet.Add .and than context.SaveChanges() . repository methods: public virtual void Add(TEntity entity) { dbSet.Add