Jump to Menu

C# Round-trip Engineering

Visual Paradigm's Visual Studio integration enables you to design your system with class diagram and generate code. On the other hand, you can update changes made in code back to the model. This makes sure both the design and source code are updated.

Compatible edition(s): Enterprise, Professional, Standard

  • November 22, 2010
  • Views: 30,955
  • PDF

  1. Select File > New > Project... from the main menu of Visual Studio.
    New project
  2. In the New Project window, select Class Library as template, enter PhoneBook as project name and click OK.
    New class library project
  3. In the Solution Explorer, right-click on the project PhoneBook and select Open Visual Paradigm from the popup menu.
    Open Visual Paradigm
  4. Click OK when the project structure dialog box appears.
    Project Structure window
  5. From the Diagram Navigator, right-click on Class Diagram node and select New Class Diagram from the popup menu. This creates a blank class diagram.
    New class diagram
  6. Select Class from the diagram toolbar.
    Select class
  7. Click on the diagram to create a class. Name it as Book and press Enter to confirm editing.
    Class created
  8. Right-click on the Book class and select Add > Attribute from the popup menu.
    New attribute
  9. Input name : String and press Enter.
  10. Input description : String and press Enter. Press Esc to confirm editing.
    Attributes added
  11. A phone book contains many contacts. Let's create a Contact class from the Book class with an association. Move the mouse pointer over the Book class. Press on the Resource Catalog icon and drag it out.
    To use Resource Catalog
  12. Release the mouse button. Select Association -> Class from Resource Catalog to create the class.
    Create associated class
  13. Name the class Contact.
    Contact class created
  14. Right-click on the Contact class and select Add > Attribute from the popup menu.
  15. Input name : String and press Enter.
  16. Input age : int and press Enter.
  17. Input phoneNum : String and press Enter. Press Esc to confirm editing.
    Attributes created
  18. Select Update Code from Diagram Navigator. You can see that two code files are generated.
    Update code
  19. Add an operation printInfo in the source code of Book class.
    Operation added
  20. Right-click on the code editor and select Update UML Model from the popup menu.
    You can see that the operation printInfo() is added to the Book class at UML model side.
    UML model updated

創造美好 共同成長

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK