You can achieve this following these steps:
1) You should change the access modifier for a navigation property by using the Batch Operations Dialog.
- To start the Batch Operations dialog, right-click on an empty area in the Visual Designer and then select Batch Operations...
- From the top left part of the window choose Display Mode -> Members.
- Find and Select the navigation property for which you want to change the access modifier.
- From the top right part of the window choose Operation -> Change Member Access Modifier and Set Access Modifier to: Private.
- Execute the operation.
- Save the domain model.
You can also find a demonstration of the Batch Operations dialog on Telerik TV
2) After that you should implement the logic for the Dictionary. I would recommend you to expand your class with a partial class and add there a property which returns a dictionary.
For your convenience I prepared the following code demonstrating this approach.
, Result> _resultDictionary;
, Result> ResultDictionary
._resultDictionary = Results.ToDictionary(res => res.Key);
3) By default Telerik OpenAccess ORM
uses Lazy Loading
which means that when objects are returned by a query, related objects are not loaded at the same time. By default, they are loaded until explicitly requested using a navigation property. The code above will load the dictionary this way.
If you want to use Eager Loading
for the navigation property and the new dictionary and load them along with the Measure object, you should create a FetchStrategy
(EntitiesModel1 context =
FetchStrategy fetchStrategy =
fetchStrategy.LoadWith<Measure>(m => m.Result);
context.FetchStrategy = fetchStrategy;
For using FetchStrategy you should include Telerik.OpenAccess.FetchOptimization
You can take a look at the dedicated video about Fetch Strategies on Telerik TV
Note that the Dictionaries that you add in partial classes will be accessible in a read-only manner, meaning that if you add an item to a dictionary, the link between the parent and the child object will not be automatically persisted in the database. Also, for performance reasons, what I have recommended involves loading the collection into a dictionary only once, so any changes in the database that might occur afterwards will not be represented in your dictionary (unless you take manual actions to reload it).
If you need any further assistance with OpenAccess ORM
do not hesitate to contact us again.
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.