Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
How to: Add an Object as a Project Data Source
Programmer's Guide > OpenAccess ORM Classic (Old API) > OpenAccess Tasks > Bind Data to Controls > How to: Add an Object as a Project Data Source

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

You can create data sources that are based on your objects in a Visual Studio application. After you define a persistent type as a data source in a project, you can create forms that display Telerik OpenAccess ORM persistent data by dragging items from the Data Sources window onto forms. These items become controls on the form that are bound to the data source.

In this topic, you will create a data source for the CustomerOA type in the Northwind Data Model. You will then use this data source to create a Windows form with controls that are bound to persistent data. To complete these procedures, you must have already added the Northwind data model to your project and configured your project to use Telerik OpenAccess ORM tool. To do this, complete the procedures in How to: Use a Data Model Defined in a Class Library.

To create a data source based on the CustomerOA type:

  • If you have recently added the data model, build the project.
  • On the Data menu, click Add New Data Source.
  • On the Choose a Data Source Type page, select Object.
  • On the Select an Object You Wish to Bind to page, the project node, expand the project's namespace node, and select the CustomerOA type in the tree view.
  • Click Finish.

The CustomerOA data source is added to the Data Sources window.

A reference to the Telerik.OpenAccess.dll must be included by the project that contains the data source and the associated data controls.

To add data source bound controls to a Windows form:

  • In the Data Sources window, expand the CustomerOA node.
  • Drag one or more properties from the SalesOrderHeader node to the form.

This creates the customerOABindingSource and customerOABindingNavigator controls on the form. A data-bound control is also created on the form for each property, accompanied by an appropriately titled label control.