The following section will show you how you can take advantage of generating against stored procedures and views.
We will start by going back into our Entities.csp Edit Output dialog as shown in the previous step. You can open this dialog 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.
Once the Entities Edit Output dialog is opened, you will need to check the IncludeFunctions and IncludeViews properties as shown below. When we set these two properties to true, the templates will enable stored procedure and view support.
Since earlier versions of the templates didn't support views and stored procedures, we decided against breaking backwards compatibility with the Entities output. This saves you from having to reconfigure all of your outputs when upgrading. But this also prevents you from selecting what business object type a view and stored procedure will be generated as. Since you can't choose a view or stored procedure inside of the Entities.csp Edit Output screen. You might be wondering "How do I configure my business object types then?" The solution is to control this by adding an Extended Property to your stored procedure or view!
Here is a list of the valid Extended Property names that can be added to an existing view or stored procedure.
Extended Property Name | Extended Property Value | Business Object Type |
DynamicRoot | Dynamic Root | |
EditableChild | Editable Child | |
EditableRoot | Editable Root | |
ReadOnlyChild | Read Only Child | |
ReadOnlyRoot | Read Only Root | |
SwitchableObject | Switchable Object | |
DynamicRootList | Dynamic Root List | |
EditableRootList | Editable Root List | |
DynamicListBase | Dynamic List Base | |
EditableChildList | Editable Child List | |
ReadOnlyList | Read Only List | |
ReadOnlyChildList | Read Only Child List | |
NameValueList | Name Value List |
After you have added an extended property to your view or stored procedure. All you need to do is regenerate and watch your new business objects be added to the project!
Next: Where to go from here