I want a certain method from my service layer to be called whenever the property of an entity(in db layer) changes. How should I approach this is the best possible manner?
Options that I'm currently considering:
-
I first considered using the Observer design pattern for a while but then I'm still not sure if this is the best possible way out for a use case where I know I wont have many observers for the property change.
-
Calling the service layer method directly in a setter. But then I doubt if this is a good practice to call up service layer method directly from a setter and I'll also have to play for resolving the cyclic dependency in this case.
Any suggestion will be appreciated!
Aucun commentaire:
Enregistrer un commentaire