This section holds common questions about performing (C)reate, (R)ead, (U)pdate and (D)elete operations with Telerik Data Access.
- How do I retrieve the data?
- How are transactions handled?
- How can I retrieve the collection of objects related to an object?
- How can I insert related objects?
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.
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.