Last post Jun 18, 2014 05:10 AM by jnagasuresh
Jun 11, 2014 09:32 PM|akhilrajau|LINK
I have an asp.net application which is using jquery in the webforms. So i used WCF REST to communicate between presentation and Data Layer. I din'y use entity framework. Now the applciation is going to migrate MVC. Here i have a debate with my new TL.
He is telling there is no need Service Layer. In the controller directly access db with Entity framework. But i am thinking how the communicattion work. In MVC i can understand, in the controller methods we can convert to json and vice versa so no need to pass
to the server as json. So may be entity framework put in the contoller can communicate with db.
But i am hearing always with MVC and webapi only. So please suggst me which is the preferred way. If avoid WebApi what are disadavatages we have. Or like he told i can use simply EF in the controller or something to access db.
I can tell one problem like the product supports mobile in the future so implementing webapi make it easier like access method from the service. Or this is also possible without webapi. Please guide me
Jun 14, 2014 03:12 AM|Ruchira|LINK
He is telling there is no need Service Layer. In the controller directly access db with Entity framework.
product supports mobile in the future
If you are going to develop native mobile apps, you must definitely have a service layer in order to consume those from native mobile apps.
Please 'Mark as Answer' if this post helps you
Jun 16, 2014 02:33 AM|Nandip Makwana|LINK
It varies from application to application. As Ruchira mentioned that to access from native mobile app, you require service layer. Another scenario could be if your application exposes public API, then also it is recommended that you build it on top of service
Jun 18, 2014 05:10 AM|jnagasuresh|LINK
It is good idea to build service layer when it is being used by multiple applications (In your scenario it will desktop application, mobile app).
But if your target is only for desktop kind of application and data does not required to share to any other department with in the organization or public) it is not suggested to use service layer unless security concerns. it is over head to use service layer
unless certain need over the architecture.
for your requirement, as application targetting to use multiple platform service can be used.