Domain Method Editor
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
The Domain Method Editor simplifies the setup and use of stored procedures and database functions in Telerik Data Access applications. When stored procedures and functions are included in the domain model, you could create domain methods for them. Adding a domain method allows you to call the corresponding stored procedure from your code. You could create a method that returns a single scalar value, a collection of the Persistent Types, or Complex Types, or no value.
Starting the Domain Method Editor
To start the domain method editor:
- In the Visual Designer, open the Model Schema Explorer.
- Expand the Stored Procedures and Functions node.
- Right-click a stored procedure or function and select Create Domain Method.
Domain Method Editor - UI Reference
The image below shows you the Domain Method Editor.
The following settings and actions are available:
- Domain Method Name - the name of the generated domain method.
- Stored Procedures/Functions - the stored procedure/function for which you are creating a domain method. The drop-down displays all the stored procedures and functions included in the domain model.
- Result Sets - in case your stored procedure returns more than one result sets, they will be listed in the drop-down. You could choose which result set to materialize.
- Retrieve Result Shape - when you click the Retrieve Result Shape button, the stored procedure's schema will be retrieved from the database. The stored procedure's schema will be displayed in the grid below. Once the schema is available, you could click on Create Complex Type to create a compatible CLR type. Or, if the generated function already returns a complex type and you have changed the schema definition of the corresponding stored procedure in the database, you could automatically update the complex type it returns by clicking the Update Complex Type.
-
Result Type - specifies the return type of the generated function.
- None - the generated function does not return a value (void).
- Scalar - the generated function returns a scalar value. After you select the Scalar option, the Scalar drop-down will be enabled so that you can choose the type of the return value.
- Persistent Type - the generated function returns an existing persistent type.
- Complex Type - the generated function returns a custom (complex) CLR type. Sometimes the shape of the result returned by the stored procedure may not map to any of the available persistent types in your domain model. In this case, you would need to select a custom CLR type that can hold the result.
- Result Shape - displays the schema of the stored procedure/function. In order to retrieve the schema from the database, you need to click the Retrieve Result Shape button. Once the schema is available, you could click on Create Complex Type to create a compatible CLR type. Or, if the generated function already returns a complex type and you have changed the schema definition of the corresponding stored procedure/function in the database, you could automatically update the complex type it returns by clicking the Update Complex Type.
- Create Complex Type - once the stored procedure's schema is available, you could click on Create Complex Type to create a compatible CLR type. Sometimes the shape of the result returned by the stored procedure may not map to any of the available persistent types in your domain model. In this case, you would need to select a custom CLR type that can hold the result.
- Update Complex Type - if the generated function already returns a complex type and you have changed the schema definition of the corresponding stored procedure in the database, you could automatically update the complex type it returns by clicking the Update Complex Type.