Complex delete

Apr 25, 2014 at 10:35 PM
I am new to this framework but I think I will implement it, I however have a question that is half framework question and half design question.

If I have Controller, Service, Repository layers and I have complex entities that for instance cannot be deleted without deleting children first.

If I then try to call delete on the repository it would fail.
Should my service layer do all the logic over several repos and do all the delete logic.
Or is it better to extend the repo with a DeleteWithChildren or similar and have the repo do the deletes in the other repos as required.
Coordinator
Apr 29, 2014 at 7:18 AM
This should belong in your Repository, so all things are CRUD should be in the Repository layer. Only business logic should be in the Service layer e.g. if you needed to do any validation before deleting an order, the validation would go in you Service layer, post success of a the validation, you Service layer would call your delete which is in your Repository layer to actually perform the delete.
Marked as answer by lelong37 on 4/28/2014 at 11:18 PM