WCF is the framework used to develop web services. The idea behind a web service is that it separates the functionality used to provide raw data from the functions used to process the data and provide it to the end user. There are several advantages to this:
- If you provide an API, you do not know how the data will be used. You just want to provide raw data to a set of applications and let these applications handle the rest. The web service does just that ... it opens the application data layer, leaving it closed.
- This can improve the logistical support of the data level through forced communications. A loose connection means that the components of your application are not interwoven with each other. This is good because it makes it easy to make changes to parts of your application without disturbing the rest. For example, if it is clear that this function call will return the specified JSON object, you can make changes to the structure of the database table that provides data for this object without interfering with the code of the consumer application. This works as long as you maintain a predefined data contract, always providing data of the same type in the same format. On the other hand, if database queries, connection strings, etc. Everything is hardcoded into your application, making it very difficult to change the logic of the database.
In your case, if you are just developing small and medium-sized web applications and do not intend to run an API or a similar service, there is probably no need for WCF.
Remember, however, that although you probably do not need to write a WCF service for your application, you should still try to freely combine your application tiers like with a service. You can do this by dividing the data access code or the object (entity) definition code into separate projects. A loose connection, whether implemented using WCF or just MVC, simplifies, simplifies and simplifies your project, and overall is a very good practice to follow.
source share