1

I am at the start of a new project but I am not sure about some architectural choices. I was hoping that you guys could share me your vision on this.

The client wants an internal website to manage their clients, projects, stock/products,… Next to this they also want a website for their clients where they can view the products and order them. So for the external website only a small part of the db will be queried while the internal website will be much bigger.

At first I was thinking about using a WCF service for all businesslogic and repository. But now I am not sure since I know that only a small portion of the actual logic will be used for the external part.

Using WCF as an extra layer always brings a shitload of extra work and complexity to the project. Is it better to just reference the business/repository layer in both website projects or make use of webAPI in the external website?

Really I need to hear some other opinions before I decide what to do.

Beejee
  • 1,836
  • 2
  • 17
  • 31

1 Answers1

2

There is nothing inherently wrong with going WCF, business layer assembly, or Web API. All have pluses and minuses.

WCF would make the most sense if you may someday have a many different clients needing access to the data/business logic and these clients may need to communicate differently (i.e. HTTP, MSMQ, full duplex, etc.)

Business Layer assembly would make sense if you are quite sure the data/business logic will not need to be accessed by clients other than the 2 web applications you are developing. That's not to say you're boxed in doing this though either. You could always start here and later remove reference to the assembly, encapsulate access to the assembly within WCF or Web API, and then reference WCF or Web API from web applications.

Web API is a good choice for several reasons. It provides the ability for many different clients access to the data/business logic without all of the overhead that comes with WCF. Additionally, if you have non .NET clients you need not worry about some of the tweaks you would have to potentially make on WCF bindings. You can also take advantage of some of what MVC provides you within the Web API such as model binding and validation.

Jacob Rutherford
  • 584
  • 3
  • 11
  • Isn't it so that you can add a Web API controller to any MVC project. If this is so I could create the admin/internal website and add a Web API controller to it to provide the CRUD actions I need to implement the Order products stuff on the client/external website. – Beejee Sep 11 '13 at 06:30
  • Yes, you can indeed do that. Here is a good post about steps you need to take in order to accomplish it: [link](http://stackoverflow.com/questions/11990036/how-to-add-web-api-to-an-existing-asp-net-mvc-4-web-application-project) – Jacob Rutherford Sep 11 '13 at 14:00
  • Then i think web API is the best option for me since i only need a small portion of the logic in the other website. – Beejee Sep 11 '13 at 17:00