简体   繁体   中英

Architecture for new ASP.Net MVC Project

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.

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 (ie 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM