Contact Sales: +1-888-365-2779

Mapping and Model Creation

Home/OpenAccess ORM/Mapping and Model Creation

Telerik's object-relational mapper is a powerful framework for mapping the objects in your object-oriented domain model to your relational database tables, views, and/or stored procedures. This mapping is done within Visual Studio and is independent from source code and database - it is a virtual layer, which can be used from within the programming language to access and manipulate data.


Database-First (Reverse) Mapping

Database-first mapping is the process of creating a set of objects and .NET classes to be used in your application from an already existing database (this approach is also known as Schema-First and Reverse Mapping). OpenAccess ORM recognizes the data model, the data types and any additional information like keys and stored procedures, and then generates the object model and related C# or VB.NET code. The process is transparent and you have complete control over the created mapping by using the Create Model Wizard.


Model-First (Forward) Mapping

Model-First Mapping (also known as Forward mapping) takes your existing object model and creates an optimized database schema out of it. In Telerik OpenAccess this process is handled by the Update Database from Model wizard, which can generate the schema automatically, or assist you in taking full control over the schema, table names, column names, relations, and further optimizations, ensuring an absolutely transparent schema-generation process.


Round-Trip (Mixed Mode) Mapping

You don't have to choose in advance whether to forward- or reverse-map your project. With the help of the Telerik OpenAccess Visual Designer in Visual Studio you can employ both approaches at any moment. This unique capability is called Round-trip Mapping.


Model-First Mapping (Fluent API)

If you are one of the developers who views your code as your model (i.e. who prefers to write code instead of using visual assistance tools), Telerik OpenAccess ORM provides Fluent Mapping API that will assist you in setting up your classes for use with OpenAccess ORM without touching a designer or working with the XML mappings. The OpenAccess Fluent API covers 100% of the the functionality of the mapper, and is successfully used by Telerik's award winning Sitefinity CMS. What is better, your model can be visually adjusted in the Visual Mapping Designer, if so is required.


Mapping Stored Procedures, Views and Tables

Stored Procedures

OpenAccess allows developers to create new or reuse existing Stored Procedures, and to follow the widely adopted pattern of db logic encapsulation inside the database. Under higher security requirements the stored procedures can be used for all insert, read, update and delete operations to inject additional checks in the database server. A Stored Procedures Editor simplifies the setup and use of stored procedures.

Tables and Views

With Telerik OpenAccess ORM you can map database views and tables to classes and vice versa (forward and reverse mapping). The data exposed by the tables and views can be modified and stored back to the database.

Concurrency Mechanisms

OpenAccess supports both optimistic and pessimistic concurrency control. Both approaches can be mixed during runtime. Additionally it is possible to automatically obtain a pessimistic lock upon the first modifying access in an otherwise optimistic transaction. When using optimistic concurrency control (the default), conflicts can be detected by designated version fields, the old content of the modified fields or all fields. And you can also turn conflict detection off.


Model Creation

The OpenAccess Model is created in Visual Studio with the aid of numerous tools and wizards, which simplify the process to point-and-click table to object mapping. The model describes the application-specific object or "conceptual" model against which you can program. It raises the abstraction level above logical database schemas, which also allows you to reuse it in different applications and for different databases.


Native .NET API, ZERO Reflection, Application Portability

OpenAccess uses standard .NET conventions and idioms (inheritance, polymorphism, composition, .NET/generic collections, etc.). What's more, it does not use .NET reflection. The code is free of data access code "plumbing" and is enhanced transparently after compilation. In other words, the code generated by OpenAccess ORM closely follows all established .NET and object-oriented programming standards. 

All classes in Telerik's .Net ORM are persistent ignorant and work independently from the source code and the database. This means true portability for your applications, where you can switch the data base and reuse the same code and even data model.


Model Consumption and CRUD Operations

When updating data, you only need to modify the state of an object - OpenAccess ORM will take care of the rest. You do not need to know any of the SQL performed on the backend, because the programming model does not change. At runtime, the Telerik ORM converts the commands issued by the domain model (usually via LINQ or low-level API) into back-end database retrieval and SQL statements, effectively taking over your duty of writing the time-consuming CRUD operations. OpenAccess can help you with the following CRUD operations:

  • Create - instantiate a .NET object and add it to the OpenAccess context;
  • Read - use LINQ to retrieve objects from the database;
  • Update - once you have a reference to a persistent object, you simply make changes to the object state;
  • Delete - pass the object to be deleted to the OpenAccess context.