Export (0) Print
Expand All

Walkthrough: Designing Application Systems by Using a Top-Down Approach

Visual Studio 2008

This walkthrough guides you through designing an application system by using a top-down approach.

In this walkthrough, you will complete the following tasks:

  • Create a new system design solution.

  • Represent and expose behavior for the system definition as a Web service.

  • Define an operation for the new Web service.

  • Add two new systems as members to a system definition.

  • Rename the new systems.

  • Add a Web service to a member of the system definition.

  • Connect the two systems in the system definition.

  • Delegate the system definition's behavior to a member.

  • Continue designing the members of the system definition.

  • Implement the underlying application definitions.

You will begin designing a system by using a top-down approach. You will perform this task by creating a new system design solution. By default, this solution contains a blank system diagram and application diagram. The system diagram displays a blank system definition. The application diagram will display the definitions of any applications that you add as members to the system definition.

To create a new system design solution

  1. On the File menu, point to New, and click Project.

    The New Project dialog box appears.

  2. In the New Project dialog box, click Distributed Systems under Project Types.

  3. Under Templates, click System Design.

  4. Name the solution StoreFrontSystem.

  5. Enter a location to save that solution.

Visual Studio creates the solution. System Designer opens and displays a system diagram. Application Designer opens the application diagram in the background.

You will now represent and expose the behavior of the system definition as a Web service.

You will define and expose behavior for the system definition as a Web service. You will perform this task by adding a .NET Web Service provider endpoint to the system definition. This action also lets you connect this system to members in other system definitions.

To add a Web service to a system definition

  1. Click StoreFrontSystem on the system diagram.

  2. On the Diagram menu, point to Add, then Endpoint, and click .NETWebServiceEndpoint.

    A .NET Web Service provider endpoint named WebService1 appears on StoreFrontSystem.

  3. Click WebService1 on StoreFrontSystem.

  4. On the View menu, click Properties Window.

    The Properties window appears.

  5. In the Properties window, use the Name property to name the endpoint CatalogService.

    NoteNote:

    When you add an endpoint to a system definition, that endpoint also appears on any uses of that definition in other system definitions. If you delete an endpoint from a system definition, you will delete it from all uses of that definition in other system definitions.

You will now define a Web service operation and its parameters for CatalogService.

You will define an operation for the CatalogService Web service by using the Web Service Details window. Operations describe the method names, parameters, and other operation-related information for a Web service.

NoteNote:

By default, Visual Studio sets the language for a Web service endpoint on a system definition to Visual Basic. You will choose the actual implementation language for this endpoint when you delegate the endpoint's behavior to an application.

To add an operation to a Web service endpoint

  1. Click the CatalogService endpoint on StoreFrontSystem.

  2. On the Diagram menu, click Define Operations.

    The Web Service Details window appears.

  3. In the Web Service Details window, click <add operation>, add an operation named GetCatalog, and press TAB.

  4. In the Type box, type Catalog and press ENTER.

    NoteNote:

    Catalog is a custom type that you can define after you delegate the endpoint to an ASP.NET Web application and implement that application.

  5. Expand the operation node, click <add parameter>, add a parameter named CatalogName, and press TAB.

  6. In the Type box, type String, and press TAB.

    NoteNote:

    Visual Studio displays a list of available types when you begin typing in the Type box.

  7. In the Modifier box, select ByVal, and press ENTER.

You will now add new members to StoreFrontSystem.

You will add two new systems as members to the StoreFrontSystem system definition. Visual Studio adds a new system diagram (.sd) file to your solution for each new system you add to a system definition. Each system diagram contains the definition of each new system.

To add new systems to a system definition

  1. Click StoreFrontSystem on the system diagram.

  2. On the Diagram menu, point to Add, then System, and click Blank System.

    A new system named System1 appears as a member inside StoreFrontSystem. A new system diagram (.sd) file appears in your solution and opens in the background.

  3. Add a second blank system named System2.

You will now rename these new members.

You will rename the two new systems and their underlying definitions.

To rename new members

  1. Click System1 inside StoreFrontSystem.

  2. On the Diagram menu, click Rename.

    The Rename dialog box appears.

  3. In the Rename dialog box, select the Rename Definition check box (if it is not selected).

  4. In the Member Name box, name the member OrderSystem and click OK.

    The member and its definition display the new name.

    NoteNote:

    Visual Studio will not update the names of the diagram files that contain the underlying definitions.

  5. Rename System2 as CatalogSystem.

You will now represent and expose the behavior of a member as a Web service.

You will represent and expose behavior for a member of StoreFrontSystem as a Web service. You will perform this task by adding a .NET Web Service provider endpoint to that new member. This action also lets you connect that member to other members in StoreFrontSystem.

To add a Web service to a member

  1. Click the OrderSystem system.

  2. On the Diagram menu, point to Add, and click .NETWebServiceEndpoint.

    A .NET Web Service provider endpoint named WebService1 appears on OrderSystem and its underlying definition.

  3. Click WebService1 on OrderSystem.

  4. In the Properties window, use the Name property to name the endpoint OrderService.

    NoteNote:

    When you add an endpoint to a member, that endpoint also appears on the member's underlying definition. The endpoint also appears on any uses of that definition in other system definitions. Once you add an endpoint to a member, you cannot remove it directly from that member. To remove an endpoint from a member, you must delete it from the member's definition. This action also removes the endpoint from all uses of that definition. This requirement emphasizes how this change to a member's definition affects the uses of that definition in other system definitions.

You will now define communication pathways between the members of StoreFrontSystem.

You will define the communication pathways used between the members of a system definition at deployment. You will perform this task by connecting the two systems in StoreFrontSystem. This connection will describe a provider and consumer relationship between these two systems.

To connect the members of a system definition

  1. Click the OrderService endpoint on OrderSystem.

  2. On the Diagram menu, click Connect.

    The Create Connection dialog box appears.

  3. Under Connect to, select CatalogSystem from the Member list, and click OK.

    A connection appears between OrderSystem and CatalogSystem. A Web service consumer endpoint also appears on CatalogSystem and is connected to OrderService. This consumer endpoint also appears on the underlying definition of CatalogSystem.

You will now delegate the behavior of the StoreFrontSystem system definition to one of its members.

You will choose the member that will provide the system definition's behavior at deployment. You will perform this task by delegating the behavior of the system definition to one of its members. Specifically, you will delegate the behavior of the CatalogService Web service to CatalogSystem. This action replaces the Web service endpoint on the system definition with a proxy endpoint. The Web service endpoint reappears on the member. Both endpoints will connect to each other.

NoteNote:

The Web service endpoint also appears on the underlying definition of CatalogSystem because that endpoint becomes part of that member's definition.

To delegate a system definition's behavior to a member

  1. Click CatalogService on StoreFrontSystem.

  2. On the Diagram menu, click Delegate.

    The Delegate Behavior to System Member dialog box appears.

  3. Under Delegate to, select CatalogSystem from the Member list, and click OK.

    CatalogService now appears on CatalogSystem. A proxy endpoint appears in the previous location of CatalogService and has the same name. This proxy endpoint connects to CatalogService and exposes its behavior outside the system.

You will continue designing the members of StoreFrontSystem. You will perform this task by adding ASP.NET Web applications to the definitions of CatalogSystem and OrderSystem. These applications will provide behavior for those system definitions. You will then delegate the behavior of those system definitions to those applications.

To continue designing members of a system definition

  1. Click CatalogSystem on the system diagram.

  2. On the Diagram menu, click Open in System Designer.

    The system diagram that contains the definition of CatalogSystem opens.

  3. On the Diagram menu, point to Add, then Application, and click ASP.NETWebService.

    A new ASP.NET Web application named WebApplication1 appears inside CatalogSystem. Visual Studio also adds the definition for this application to the application diagram in your solution. 

  4. Delete the WebService1 endpoint.

  5. Name the application CatalogManager.

  6. Click CatalogService on CatalogSystem, and then click Delegate on the Diagram menu.

    The Delegate Behavior to System Member dialog box appears.

  7. Under Delegate to, select CatalogManager, and click OK.

    CatalogService now appears on CatalogManager. You will later implement the definition of CatalogManager to continue defining the behavior of CatalogService in code.

  8. Click the consumer endpoint on CatalogSystem.

  9. Delegate the consumer endpoint to CatalogManager.

    CatalogManager can now communicate outside of CatalogSystem.

  10. Click the StoreFrontSystem.sd document tab to view the system diagram for StoreFrontSystem.

  11. Repeat steps 1-3 for OrderSystem and name the application OrderManager.

  12. Delegate the OrderService endpoint to OrderManager.

  13. Click the StoreFrontSystem.sd document tab to view the system diagram for StoreFrontSystem.

The CatalogManager application in CatalogSystem now communicates with the OrderManager application in OrderSystem through the proxy endpoints on each system. In addition, CatalogManager provides behavior for StoreFrontSystem through the proxy endpoint on that system.

You will continue defining the behavior of CatalogSystem and OrderSystem. You can perform this task by first connecting the underlying definitions of CatalogSystem and OrderSystem and then implementing them. When you implement application definitions, Visual Studio generates projects in your solution so that you can continue defining their behavior in code.

NoteNote:

You must connect application definitions before you implement them. This enables Visual Studio to correctly generate any needed Web service client proxy classes.

To connect and implement application definitions

  1. Click the StoreFrontSystem.ad document tab to view the application diagram.

    Application Designer displays the application diagram, which contains the application definitions for CatalogManager and OrderManager.

  2. Connect the consumer endpoint on CatalogManager to the OrderService endpoint on OrderManager.

    NoteNote:

    Visual Studio does not connect application definitions when you connect their uses in system definitions. Connections on the application diagram represent communication pathways in the development environment, while connections on system diagrams represent communication pathways in the deployment environment.

  3. In the Properties window, set the Template property for CatalogManager and OrderManager to ASP.NET Web Application.

  4. On the Diagram menu, point to Implementation, and click Implement All Applications.

    Visual Studio generates the corresponding projects in your solution so that you can continue defining CatalogManager and OrderManager in code.

Community Additions

ADD
Show:
© 2015 Microsoft