Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Service layer vs business layer - differences?

I have been doing a lot of reading on service layers and business layers and how they compare. I have a read a number of the threads here on StackOverflow on the topic and i still find myself confused as to the differences between the two if there are any. To me it seems that its mainly a naming convention where one dev calls the middle layer a business layer and another may call it a service layer. From the code i have seen here on SO and around the web they seem to do mainly the same thing - that is query the repository, maybe do some filtering and/or validation and return the results to the presentation layer. So can anyone clarify the differences between the two? Or am i missing the mark in my assesment?

I am working with EF, MVC 3 and VBNET, FYI

like image 250
Ashok Padmanabhan Avatar asked Oct 12 '11 14:10

Ashok Padmanabhan


1 Answers

In our projects we often have the following structure:

Service layer:

  • Publishes the Service Endpoint (this could be your MVC web page, or a WCF endpoint)
  • Does a security check
  • Maps data from contract data transfer objects to business objects
  • Calls functionality in the business layer

Business layer

  • Contains business logic
  • Accesses the data layer (this could be your entity framework data model)
like image 190
Shiraz Bhaiji Avatar answered Oct 01 '22 22:10

Shiraz Bhaiji