What is the advantages and disadvantages of using services over components?

后端 未结 3 616
悲&欢浪女
悲&欢浪女 2020-12-24 09:17

From past few months I am working on projects in latest dot net frameworks.

I feel that in latest dot net versions \"services\" are encouraged over components. Is

3条回答
  •  难免孤独
    2020-12-24 10:17

    "Cross-language" compatibility is another advantage. You can write a service in C#.net which can be accessed also from Java. So reusing goes beyond programming language usage.

    What is the advantages? What about the performance if all the layers are exposed as services instead of DLLS?

    I would pay attention to this point here. What do you mean by "all layers"? Application layers such as Business and Data Access Layer?? I doubt that this may be useful (of course it depends on your context) but usually a service is something that may be reused in many different contexts. An example could be a service for validating the Fiscal code. You would then call this service from your application's business layer. I cannot imagine of a case where you would expose the business layer as separate service and the data access layer as another separate one. Usually they are quite specific for your application that you're developing. What could be is that you have an application that is for instance accessible through the web (as web application) and there is another entry point through a web service that other apps can use (some kind of API). That would make sense, however you wouldn't directly expose your business layer but rather create some kind of "gateway" which is your webservice (a lightweight facade that delegates to your business logic classes).

提交回复
热议问题