Reputation: 41
Do the word/terminology Service is always associated with WebService Or Windown Service. I like to encapsulate my behaviors in Service class. Example EmployeeService which may in tern use the employee repository to get required info/data from DB. Am I doing anything wrong ?
Upvotes: 0
Views: 33
Reputation: 41
I look at it from different perspective, a service is class/layer which will facilitate me do any thing related to employee object. It abstract the internal details and just gives me what I want or want to do with employee object. It may internally use web service to get the employee data or may use a window service to shoot a password reset mail to mentioned employee. Service is the place where you can control, if you really wanna connect to database or webservice or windows service to complete a task or use a stub/fake implementation to test your UI or critical business logic independent of other resource being available or not.
Upvotes: 0
Reputation: 136
A Service is something which "to me" should have an interface for what it is serving. Something which would act upon the Employee or for the employee would be an extension or a function within the Employee class itself. (this is strictly opinion so your naming conventions are your choice)
Upvotes: 0
Reputation: 5127
Example EmployeeService which may in tern use the employee repository to get required info/data from DB. Am I doing anything wrong ?
That is perfectly fine. You can always follow this while naming your classes that contain business logic.
This is our choice, not a standard or guideline. So the answers will be opinion based, but I strongly prefer it over EmployeeBL
, EmployeeLogic
and what not.
Upvotes: 1