WCF Service Layer in n-layered application: performance considerations
- by Marconline
Hi all. When I went to University, teachers used to say that in good structured application you have presentation layer, business layer and data layer. This is what I heard for more than 5 years.
When I started working I discovered that this is true but sometimes is better to have more than just three layers. Two or three days ago I discovered this article by John Papa that explain how to use Entity Framework in layered application. According to that article you should have:
UI Layer and Presentation Layer (Model View Pattern)
Service Layer (WCF)
Business Layer
Data Access Layer
Service Layer is, to me, one of the best ideas I've ever heard since I work. Your UI is then completely "diconnected" from Business and Data Layer. Now when I went deeper by looking into provided source code, I began to have some questions. Can you help me in answering them?
Question #0: is this a good enterpise application template in your opinion?
Question #1: where should I host the service layer? Should it be a Windows Service or what else?
Question #2: in the source code provided the service layer expose just an endpoint with WSHttpBinding. This is the most interoperable binding but (I think) the worst in terms of performances (due to serialization and deserializations of objects). Do you agree?
Question #3: if you agree with me at Question 2, which kind of binding would you use?
Looking forward to hear from you. Have a nice weekend!
Marco