Trying to get my head around removing dataStore access from my entity classes.
Lets say I have an AccountsGroup entity class. I put the all DBAccess into AccountsGroupRepository class.
Now should I have a DeleteFromDB method in the AccountsGroup class, that will call the repository?
Public Sub DeleteFromDB dim repository as new AccountsGroupRepository(me) repository.DelteFromDB End Sub
Or should I just always use repositry whenever I need to delete an entity, and not have the CRUD methods in the entity class?
What happens when there is some business logic validation that needs to be done before the delete can proceed. For example if AccountsGroup still has some Accounts in it the delete method should throw an exception. Where do I put that?
© Programmers or respective owner