I have following classes in my web api business layer, i was wondering if GatewayService class should be in Business layer or should i put that in separate project called BusinessService? because its not being directly called in controller class and it doesn't depend on data repository ?
Business Layer
- GatewayService (referencing < dll file > methods and making calls to external web service and returning list of transactions)
- UserService (returns a list of all users from production database using < repository class > from data layer)
- TransactionService ( get a list of all users from < UserService > and then get all their transactions from < Gateway Service > )
Here is what Transaction Controller doing;
Transaction Controller
Getting a list of users from < UserService >
Passing a list of Users to < TransactionService > which will then return a list of user transactions
Passing a list of all transactions to < TransactionService > to process them through a data repository class
In case of N-Layer architecture
TransactionService
should be in anApplication
layer, then yourGatewayService
can be part of theBusiness Layer
.In case of Clean Architecture
GatewayService
should be part ofPresistence
orInfrastracture
layer so it is not abusiness
layer (heredomain
andapplication
).