In this section we are going to cover how to change Category's business object type. You may want to change how the business object behaves by changing its type. In this example, we want our Category business object to act as both a parent and a child business object. To do this, we will need to change the type from EditableRoot to Switchable Object.
You can configure each entities business object type quickly and easily through Manage Outputs. Lets start by right clicking the Entities.csp template and selecting Manage Outputs. After the manage outputs dialog comes up double click on the Entities.cst item. You can control exactly what gets generated right inside of Edit Outputs.
Now lets change Category from an EditableRoot to SwitchableObject. We can do this by selecting the "..." button for the SwitchableObject Property. Next, we would hold the control key to allow selection of multiple items and select Category.
As you can see, the Category database table was removed from EditableRoot and placed into Switchable Object!
The Entities template is smart enough to realize that you may want both an Editable Object as well as a Read-Only object. When the template detects this, it will not remove the previous choice and allow you to generate two business objects.
Now we can save our settings by clicking the OK button on the Edit Output dialog. When we regenerate the project, the criteria business object will be regenerated as an SwitchableObject.
Any time you need to change a setting, you can just go back into the Edit Output dialog and change business object types, Data Access Implementation and much more!
In the next step we are going to cover generating business objects from a stored procedure or view.
Next: Generating from Views and Stored Procedures