I have an application that has layers for data access, business, and wcf service. I need to convert this WCF layer to Web API and am stuck on whether I should:
1) Create two service layers/projects: - Services (class library) - Services.Api (WebAPI to expose and wrap calls to the services class library)
2) Or, just create a single WebAPI project.
I guess the issue I see with #2 is it limits how I'm able to reuse the library - I can only use the services using REST. With #1, I have the ability to use the class library when needed inside of my web controllers and WebAPI on the client/ajax as needed. The issue I see with #1 is all the extra code needed to repeat calls to the service layer class library.
Hope that make sense. Please let me know your thoughts on what might be a good approach and practice for me to follow, or scream at me for my lack of understanding. Thanks
If you have a good business layer that itself should be your Services(class library) layer. On top your Business/Services layer, should be your front end layers which could be the Wcf, Api or Mvc.
ProjectName
-ProjectName.Core (All poco classes and interfaces)
-ProjectName.Data (All entity framework stuff)
-ProjectName.Service (All business logic)
-ProjectName.Web (All font end logic)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With