Web Services Software Factory: A modeling version, also known as a service factory, is a collection of resources that can help you model and build Web services in Windows®communication Foundation (WCF) and ASMX in a simple and efficient way. Compared to previous versions of the Service factory, the latest version uses a model, and the previous version uses a wizard based on guidance Automation Toolkit (GAT). The Service factory now allows you to build WEB services by creating three different models: the data contract model, the service contract model, and the host model. We'll discuss the three models first, and then we'll explain how to customize the Service factory. You can find more information in the Web sites listed in the "Online Service Factory resources" sidebar.
The main disadvantage of using the GAT Wizard to generate code is that it is more complex to make the necessary changes to the generated code. Suppose you want to rename an operation in the build service, you must save the custom code and then redo the entire wizard where you want to use the new name or rename the operation in the generated code. The Redo wizard is a time-consuming task; Because the wizard has no memory, you must reassign the entire contents. Changing the code generated by the wizard is also not ideal, because you want to go back and deal with a lot of details, and the purpose of the wizard is precisely to avoid this. The model provides a good solution for this problem, and it remembers what you have entered, compared to the wizard.
Building a modeling language that is integrated into Visual studio® was difficult in the past, but Domain-specific Language (DSL) Tools with the visual Studio SDK made this work very easy. The service factory now comes with three models built using DSL Tools. Please note that there is no model for data access and service security. The Data Access Guide pack in a previous version of the Service factory is now a separate factory, called a repository factory, and the Security Guide pack becomes a separate available packet for the Service factory community site.
The new version of the Service factory also provides a good example of how to build your own software factory, because it uses and combines all the tools available to build a:
Wizard GAT to build the project and provide a context menu
DSL Tools for three different models
Designer Integration Service (DIS) that supports cross model references
The Service factory source code also contains some interesting libraries with features that are not currently available in the factory tools. If you are building your own factory, it may benefit you to reuse the following items:
Code generation Library, which allows you to generate code in a separate file
Cross-model validation library to assist you in validating cross model references
Visual Studio mock Object Library to help you easily unit-Test your factory
As we have mentioned, the service factory is made up of three kinds of models. In the data contract model, data conventions for WEB services are defined. In the service contract model, services, service contracts, operations, and messages are defined. Finally, host models are used to model service endpoints and client proxies.
To introduce the factory, we will create a WEB service that orders pizza from Peedy's Pizza shop. This WEB service can accept pizza orders and allows you to buy pizzas of different sizes and toppings. When an order is submitted, the order price is returned to the customer for confirmation.