Unfortunately there is not code sample that demonstrates how to create caching repository with OpenAccess
One important thing that you should consider is that OpenAccess
has build-in cache
- Level 1 - Embedded in the OpenAccess context instance - caches entity instances during the lifetime of the context. Enabled by default.
- Level 2 - Shared between all OpenAccess context instances. By default it is disabled. You can find more about Level 2 caching here.
If the out of the box caching is not enough, you can implement the caching mechanism inside a custom repository class that is used as base for all concrete per entity repositories.
Or you can implement caching of the DTO
objects on service
or assembler level
The decision on which layer to implement it is completely yours and depends on your application architecture.
Either way after you have set on certain implementation I advice you to create a dedicated T4 template
to be used in Add OpenAccess Service wizard
in order to minimize repetitive tasks of changing generated code after each run of the wizard. You can follow the steps in this tutorial
in order to create a custom code generation template and enable automatic custom template discovery in the wizard.
If you need any further assistance implementing custom cache or you need more information about Level 1
build-in cache implementation, do not hesitate to contact us.
the Telerik team
Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.