Telerik OpenAccess ORM applications and services are based on a Data Model. This model represents application data as a set of types and relationships that are mapped to a defined data source. A data model consists of a conceptual model expressed as types and relationships, a storage model that represents the schema of the logical model, and a mapping between the two. The development phase of a project usually starts with the conceptual model, and then the logical model is derived from the conceptual model.
To meet the needs of developers who want to derive a Data Model from an existing database, Telerik OpenAccess ORM provides a set of modeling tools that generate a data model, validate a data model, and create programmable class based on the conceptual model.
Telerik OpenAccess ORM includes an integrated set of Data Model tools which set generates a model that includes selected objects from a data source. For more information, see the Development Environment section.
Working with Telerik OpenAccess ORM starts with the creation of the object model (without having to care about databases or table layout). The process of having domain objects in the application scope that have to be persisted, but there is no database schema defined for them in advance, is called "Forward Mapping". A persistent class instance is one, which retains its field values after a program terminates. When the program is run again, these objects can be retrieved and the data which they contain is again available. When creating a program, a declaration of persistence capable class types is required. This declaration is done by typing the [Persistent] attribute above each class definition manually or by using the Forward Mapping Wizard. It is available from the OpenAccess menu after enabling the project to use OpenAccess. The Forward Mapping Wizard will enable the [Persistent] attribute for all classes that have the Make this class persistent option checked.
||If a class references another class via a field, then this class needs to be marked with the [Persistent] attribute as well.|
For more information and description of the wizard, see Forward Mapping Wizard.
The persistence capable classes, themselves, are written in the same way as any other class. Except for the [Persistent] attribute, Telerik OpenAccess ORM does not impose any additional language elements (keywords) in the source code for the definition of a persistence capable class. For more information, see How to: Use the Forward Mapping Wizard.
In cases where you have an existing database schema that you would like to use within an application, use the Reverse Engineering Wizard, which is a graphical tool that can be used to generate or update classes based on tables from an existing schema.
Some of the features provided by this tool are:
- Classes are generated in .NET supported languages. Currently it supports C# and VB projects. The code generation is completely based on user changeable template files.
- Tables can be reverse engineered to classes, collections - 1:m, m:n and maps. Tables and columns can also be ignored.
- Schema changes can be made as per your requirements and can be migrated to the existing mapping using the "Merge Schema Changes" feature, thereby keeping the class model and schema in sync.
- Invalid and erroneous mappings are detected and appropriate messages are shown.
- You can preview the code that will be generated. This preview updates immediately to reflect any changes that you make. Various changes can be made, such as changing the mapping for a value field, adding a 1:m or m:n collection field in a class.
- Object references are automatically generated for Foreign Key constraints between tables. They can be adjusted inside the wizard.
- You can use an already defined sequence column as a key generator. If a sequence column is present in a database it is automatically detected.
||Before using the Reverse Mapping wizard you should enable your project to work with OpenAccess ORM.|
For more information, check out the following topics are included:
Schema Merge Dialog