Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
Artificial Fields and Types
Programmer's Guide > OpenAccess ORM Classic (Old API) > Programming With OpenAccess > Artificial Fields and Types

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.

The idea behind the artificial fields and types feature of Telerik OpenAccess ORM is to enable developers to create and/or extend their persistent model during runtime. OpenAccess gives the opportunity to add fields of the existing compiled persistent classes or adding new persistent classes without the requirement of writing additional code and more development iterations. The artificial fields and types are described inside an xml node and that can be done dynamically depending on the application’s business logic.

Under the hood, OpenAccess takes care of transforming these entries into meaningful Type or Property Descriptors. Using the Generic Metadata Access API, OpenAccess gives the opportunity to operate on such fields and do all CRUD operations that are doable using the compiled Persistent Classes and the standard API from OpenAccess.

The above relates to the in-memory representation of the entities inside Telerik OpenAccess ORM. The relational representation of those fields is the same as with the usual persistent-capable classes. It is doable by invoking a clever mechanism that uses the runtime schema changes API and the forward mapping capabilities of Telerik OpenAccess ORM.The following code demonstrates an example of how this API can be used to update the database schema during runtime:

C# Copy Code
string ddlscript = database.GetSchemaHandler().CreateUpdateDDLScript(null);  if (!string.IsNullOrEmpty(ddlscript))      database.GetSchemaHandler().ExecuteDDLScript(ddlscript);  

In order to enable OpenAccess to look for artificial fields in the project, the artificial-types extension node should be added under the current mapping node:

App.config Copy Code
<mappings current="mssqlMapping">
<mapping id=" mssqlMapping">
<extension key="artificial-types" value="" />

In the following section, two main topics that form this feature will be discussed: