Manage Navigation Properties Overview
Being an object - relational mapper, Telerik OpenAccess ORM allows you to perform CRUD operations on your database tables with the help of object oriented concepts. From this point of view, OpenAccess ORM models the constraints between the tables with the help of the so called navigation properties.
Generally, a persistent class contains fields and properties that match by name and value type the columns in a corresponding database table. In addition to these fields and properties, the persistent class may have navigation ones if the table it is mapped to, participates in a relationship. For example, the Categories and RentalRates tables (the SofiaCarRental sample database) are in a one-to-many relationship, where the Categories table is the parent table and RentalRates is the child table:
In Visual Designer the two classes would look like this:
Note that both classes have an additional property in their Navigation section. The Category class has IList<RentalRates> RentalRates which basically is a list of all rental rates that belong to a given category, while the RentalRate class has Category Category which is a reference to the category for every rental rate.
These navigation properties allow you to easily access in your code the parent object of a given child object and the collection of child objects of a given parent.
Apart from accessing the objects on the other side of the association, the navigation properties can help you to insert, update and delete related objects in the database. For that purpose, they need to be managed in a certain manner - through the IsManaged property of the association in Visual Designer.
IsManaged instructs OpenAccess ORM to track additions and removals of items in the collection navigation properties and to issue the proper statements during SaveChanges(). By default, the IsManaged property is set to False for one-to-many and many-to-many associations for performance reasons and to True for one-to-one associations.
Setting IsManaged to True for one-to-many and many-to-many associations could lead to decreased performance when working with large databases, containing hundreds of thousands of objects participating in such relationships.
This section will provide you with the necessary information about how to use IsManaged according to the type of the relationship that two database tables can share: