Data Access has been discontinued. Please refer to this page for more information.

CRUD Operations

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.

This section holds common questions about performing (C)reate, (R)ead, (U)pdate and (D)elete operations with Telerik Data Access.

  1. How do I retrieve the data?
  2. How are transactions handled?
  3. How can I retrieve the collection of objects related to an object?
  4. How can I insert related objects?

How do I retrieve the data?

You can access your data through an instance of your domain context. The context is a child class of the OpenAccessContext which can either be generated by the Add New Domain Model Wizard, or defined by you if you are using the code-only approach. This class contains read-only properties that return an IQueryable of each type that you want to work with. You can use these properties to read the objects you want from the database. For more information, take a look at the CRUD Operations section.

How are transactions handled?

All the changes you make using a single context are considered a transaction, which can be committed through the SaveChanges method. You can also perform a rollback through the ClearChanges method. A new transaction is started automatically afterwards.

You can set a FetchStrategy for your context, defining the tree of referenced objects that have to be loaded.

The domain classes are connected through their navigation properties, which are generated based on the associations defined between the classes. In order to use the collection navigation properties to add new related objects, you have to set the IsManaged property to True for the target end of the association you are using. Telerik Data Access is able to insert your related objects in the correct order and with correct values, even in cases where the primary keys are auto-incremented by the database.