Creating a Complex Type via the Model Refactoring Wizard

ExpandedToggleIcon        Using the Model Refactoring Wizard for new complex type creation

For this example we use the following two classes that have common properties (there must be at least 2 common properties):

images_refactoring-wizard-type1

We select the two classes, call their context menu, and select the Model Refactoring menu item.

The Choose Action page of the Model Refactoring Wizard is displayed:

images_refactoring-wizard-type2

In the dialog box we select the New complex type option, specify its name and click Next.

The Choose complex type properties page of the Model Refactoring Wizard is displayed.

images_refactoring-wizard-type3

Here we select the properties we want to move to a new complex type and click Finish.

note Note

To select or deselect all of the displayed properties, right-click in this page and in the context menu select Check All or Uncheck All respectively.

note Note

If you create a complex type for several classes with a similar subset of properties using Model Refactoring, and these properties have different facets in different classes, facets from the class that was selected first are taken as a facets for the properties of a new complex type.

As a result, we get a new complex type containing common properties of the two classes, and the classes obtain a new complex type property:

images_refactoring-wizard-type4

 

ExpandedToggleIcon        Using the Model Refactoring Wizard for moving class properties to an existing complex type

For the purpose of this example we take the model we created in the subsection Using the Model Refactoring Wizard for new complex type creation and complement it with one more class:

images_refactoring-wizard-type2-1

Then we select the new class, call its context menu, and select the Model Refactoring menu item.

The Choose Action page of the Model Refactoring Wizard is displayed:

images_refactoring-wizard-type2-2

On this page we select the Existing complex type option, select the complex type name in the drop-down list and click Finish.

note Note

Click the Preview link to preview the existing complex type properties in the Type Editor dialog box.

As a result, the complex type contains common properties of all three classes, and the classes contain the corresponding complex type property:

images_refactoring-wizard-type2-3

 


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.