Suppose you have entities, a service level, and repositories (with ORM, for example, NHibernate). User interfaces interact with the service layer.
What types of code are appropriate for the service level?
Repository coordination?
It seems that entities should not reference a repository , therefore there should be calls for loading / saving / sending entities at a service level?
Business logic involving repositories?
If the above value is true, should there be something like checking if the username is different at the service level (i.e., calling GetUsersByUsername and checking the results)? Before assuming that the database should handle different ones, how about checking that the password has not been used for 90 days?
Business logic that includes multiple entities?
I'm not sure about this, but I will say that you need to apply the operation against a collection of objects that may or may not be related and are not actually applicable to a single object. Should entities be able to work in these collections, or does something like that belong to the service layer?
Mapping?
If you use DTO or send your objects to / from your service level, you will most likely finish the mapping (preferably with AutoMapper). Does this relate to service level?
I am looking for confirmation (or rejection) of the above ideas, as well as any other thoughts about the responsibility of the service level when working with entities / repositories.
source share