Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SaveRecipes currently replaces the recipes #420

Open
1nf0rmagician opened this issue May 8, 2024 · 4 comments
Open

SaveRecipes currently replaces the recipes #420

1nf0rmagician opened this issue May 8, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@1nf0rmagician
Copy link
Member

The behaviour of the method was surprising at first site but I would not consider it a bug. My question is, do we want to adjust the method in the future? We shhould probably add a better comment do describe the behaviour, but do we need an extension method to just add a collection of recipes?

@dbeuchler, @Toxantron, @dacky179

public void SaveRecipes(long productId, ICollection<IProductRecipe> recipes)

@1nf0rmagician 1nf0rmagician added enhancement New feature or request question Further information is requested labels May 8, 2024
@1nf0rmagician 1nf0rmagician added this to the Framework 10.0.0 milestone May 8, 2024
@1nf0rmagician 1nf0rmagician self-assigned this May 8, 2024
@dbeuchler
Copy link
Member

What do you mean by "replaces the recepies"? The collection is not updated (maybe just the Id is set if 0)

@1nf0rmagician
Copy link
Member Author

All recipes that are not in the collection given as a parameter are deleted from the database when you call that method. What I and @dacky179 expected, however, was that the given recipes would be added to the existing ones or update them.

@dbeuchler
Copy link
Member

All recipes that are not in the collection given as a parameter are deleted from the database when you call that method

Ahh okay this is really missleading - I also would not expect that Save.. removes something. I would remove that from the method and provide a RemoveRecipes(recipes) method.

@Toxantron
Copy link
Member

All recipes that are not in the collection given as a parameter are deleted from the database when you call that method

Ahh okay this is really missleading - I also would not expect that Save.. removes something. I would remove that from the method and provide a RemoveRecipes(recipes) method.

This would however break exisiting behavior. The original idea and usage of the old UI was:

  1. GetRecipes(...)
  2. Modifiy collection, remove, add und update objects
  3. Call SaveRecipes

Somewhere from WCF internal endpoint to facade use Web endpoint we broke this. I generally agree though, Save should not delete things

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants