简体   繁体   中英

Using service layer in Repository Pattern for “Standard” business logic / Utility methods?

I am using a standard repository pattern with a service layer which calls the data layer..

I have some Utility classes ie one that deals with Sending email (method name = SendMail)

Where is the correct place to put this?

Inside the service layer as a method called SendMail

hence I have CustomerService which calls CustomerRepository

So in this case i create a new UtilityService which will hold all the business logic for utility classes ie Sendmail

Little bit confused where i should put these

Any help really appreciated

You can think of your sevice layer as having two levels first is a coordination / aggregation layer that calls the second layer which is the individual services, this will include the utility service.

In some cases this can be overkill since you get a lot of pass-through services.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM