How to: Convert CRUD Stored Procedures

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.

One of the most important characteristics of the L2S Conversion Wizard you should get familiar with is the conversion of CRUD stored procedures.

Suppose that your basic L2S model contains one entity and three stored procedures used respectively for insert, update and delete.

By default when you perform CRUD operations runtime, the system automatically generate insert, update, and delete logic. However in this example the Region CRUD behavior is customized with specific insert, update, delete procedures.

The L2S Conversion Wizard supports stored procedures conversion. In this example the InsertRegion, UpdateRegion and DeleteRegion functions will be converted successfully by the wizard. However they will not be used as CRUD procedures in the converted model. This is because the specific naming convention for CRUD procedures used in Telerik Data Access Domain Model. That's why in this specific scenario the L2S Conversion Wizard will create three additional procedures (sp_oa_ins_region, sp_oa_upd_region, sp_oa_del_region) and will add them in the domain model.

Note that the original InsertRegion, UpdateRegion and DeleteRegion stored procedures will be converted, too. However, in the converted domain model, sp_oa_ins_region, sp_oa_upd_region, sp_oa_del_region will be used as crud procedures for the Region object. At this point the newly added procedures exist in the domain model, however, they does not exist in the database. The last step you need to perform in order to use the converted domain model at run time, is to create the corresponding procedure in the database. You can do that manually, or you can use the Update Database from Model wizard.

For a complete walkthrough illustrating how to use the Telerik Data Access LINQ to SQL Conversion Wizard, check out the How to: Convert from L2S Model to Telerik Data Access Domain Model topic.