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

CRUD Operations

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 context class. The context should inherit the OpenAccessContext and should contain read-only properties that return an IQueryable of each persistent class 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 instance 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 persistent classes are connected through their navigation properties, which are based on the associations defined between the classes. In order to use the collection navigation properties to add new related objects, you have to explicitly specify the collection navigation property on the target end of the association as managed. 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.