In Telerik Data Access, the domain context is the channel used for retrieval of database objects and updating the database with the changes you make. Its main purpose is to translate your requests into SQL queries that are performed against the database and to assemble objects from the returned result. Usually, Telerik Data Access generates the context class for you during the creation of the model, but it also allows you to explicitly specify whether it is necessary.
This topic will demonstrate to you how to control the context generation while creating the model and on a later stage when you modify it. In both cases you would use the Code Generation Settings page in either the Advanced Options dialogue of the Create Model wizard or the Code Generation Settings tab in the Model Settings dialogue.
The process is as follows:
- Navigate to the Advanced Options dialogue of the Create Model wizard or open the Code Generation Settings tab in Model Settings.
In the Code Generation Options section check/uncheck the Generate Context check-box
Click Finish if you are using the wizard or OK for Model Settings
- Save the domain model if you are using the Model Settings dialogue
In both cases your project will contain a file for the context but it will be empty:
In case your domain model was created with domain context and you have just disabled the Generate Context option, the context file will remain in the project but its content will be removed. Once you decide you need it, you can enable back the setting.