EFCore Collection Trying to save a duplicate.
I'm building a dotnet maui app, and when I try to save a
Here's the models:
Equipment:
Here's the code that saves it:
At a break point at the
It then throws an error on the
Rental with a ICollection<Equipment> to my database, it errors saying that the equipment already exists.Here's the models:
Equipment:
Here's the code that saves it:
At a break point at the
createdRental == null line, it shows that there are two equipments in the List.It then throws an error on the
db.SaveChangesAsync() line. I think I just need a way to tell EFCore to not save the elements in the list, but to just create a link to them from the Rental im trying to save.
