Before i remove a product via de WebApi i also remove the assignment of a product in a category by calling DELETE $"{serverBaseUrlOData}Products({ProductID})/ProductCategories({CategoryID})" quickly after calling this endpoint I then delete the product from the OData collection. All goes wel without any error and the product is also deleted. But the category assignment sometimes still remains. When I check the /Product_Category_Mapping table in the database the mapping is really gone. The only fix is by deleting the product in the SQL database itself...
Category product assignment orphin?
#1
Geschrieben: 15 May 2020 - 10:01
#2
Geschrieben: 15 May 2020 - 11:31
Marcus Gesing
Smartstore AG
#3
Geschrieben: 15 May 2020 - 11:55
Yeah sometimes sounds vage, to be honest i didn't had much time to track down in which condition this happens. Nevertheless i changed the routine with your tip. This feels like a better way!
I also saw that this applies to manufacturers and pictures so i changed that as well. Is it also supported for SpecificationAttributeOptions?
Maybe you could describe what the best way is to delete a product via de OData webapi? Or is there a DeleteProduct(ID) function that takes care of all stuff that i'm overlooking? The current way how i deleted OData objects is by removing them from the OData collection by calling: DELETE /odata/v1/Products(id)
In addiotion maybe you could add this type of function to the OData metadata and Swagger documentation?
#4
Geschrieben: 15 May 2020 - 12:43
- TripleNico gefällt das
Marcus Gesing
Smartstore AG
#5
Geschrieben: 18 May 2020 - 09:15
Alright so if i just call DELETE /odata/v1/Products(id) then the WebApi service will take care of all the cleanup (Pictures, categories, manufacturers, attributes, specifications, etc...) ??
Because if so i will just only call that function when deleting a product
#6
Geschrieben: 18 May 2020 - 10:53
No, because products are marked as deleted instead of physically removed. Related entities are not touched.
Because if so i will just only call that function when deleting a product
That's ok, because that's exactly what happens when a product is deleted in backend.
- TripleNico gefällt das
Marcus Gesing
Smartstore AG
#7
Geschrieben: 18 May 2020 - 12:08
Thanks for the info! :-)