Question

I currently am setup up a Visual Studio solution using the onion architecture. I have a pretty good understanding on how to structure the solution but I am running into a bit of a pickle. My solution is consuming multiple APIs. These API's are consumed using WCF, Soap Web services, and RESTSharp for REST services. I am not sure how to structure this.

The biggest confusion is around REST services since this not only uses RESTSharp but also some POCO classes that are used for serialization. I also have:

ApiResult<T> where T is any of the POCO classes.

My first thought was to create Infrastructure.RestSharp where I would implement my interfaces that all have return ApiResult but the questions is where do I put the these POCO classes and the ApiResult? They would have to go in the Core somewhere since the interfaces are using them, but where would be a good place to put them?

What about the WCF and soap services? Would I create a Infrastructure.WebServices?

Was it helpful?

Solution

Maybe this will help. Here is a diagram I use for setting up my Visual Studio projects using Onion Architecture. The arrows show which projects have references to others. Blue boxes are projects that I create. The orange items are 3rd Party projects or .NET APIs.

  • The UnitTests, Web (UI), and Dependency Injection and Data Access Layer projects all reside on the outside layer of the onion.
  • All references point inward towards the Core (Except the outside layers, which can point sideways).
  • All APIs are accessed through outside layer projects.

Onion Architecture Diagram

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top