Telerik blogs
  • Productivity

    Telerik OpenAccess ORM and the Second Level Cache

    As we already mentioned last week, Telerik OpenAccess ORM manages two cache levels – one specific for each ObjectScope instance and another shared by all scopes. The shared cache is generally called the "2nd level cache" or the "L2 cache". Its main job is to hold copies of the database content in memory. The L2 cache is populated during read access and gives fast retrieval of commonly used objects. This could be extremely helpful in multithreaded applications, where every single thread has its own ObjectScope. In order to avoid too many calls from each scope to the relational server, the L2...
    May 27, 2021 3 min read
  • Productivity

    How Does the First Level Cache of Telerik OpenAccess ORM Work

    Telerik OpenAccess ORM has two levels of caching. The upper one is a local cache specific for each IObjectScope instance and it is the focus of this post. The lower cache, the second level cache is common for all IObjectScope objects and is used to hold unchanged database content in memory. The values for various fields of the user objects (like a Person instance) are duplicated in the L2 cache. It is populated during read access and gives fast retrieval of commonly used objects. Additionally, the cache can contain complete query results. Note that the L2 cache is not enabled by...
    May 27, 2021 3 min read
  • Productivity

    Retrieving object from the database using only its key

    When you try to persist an object Telerik OpenAccess ORM will require an “identity” so that the object is uniquely identified for storage and retrieval. Usually this id is mapped directly to a primary key column or columns (composite key) in the database and identifies also the in-memory representation of the object. Using this identifier, you can directly retrieve the object from the database. Supposing that we have table with an int primary key (for example the Category table from the Northwind database) and we want to retrieve the Category with id that is equal to 6 directly. We would need...
    May 27, 2021 3 min read
  • Productivity

    LINQ Tip of the week: A quick peek behind the curtains

    In our previous post in this series we had a look at how to optimize query execution with the help of parameterized queries. Today we will briefly look at what actually happens ‘behind the curtains’ when a LINQ query is executed and you get back  the results.   As you already know LINQ can be used to query various data sources like in-memory objects, XML or databases,which is of particular interest to us. Consider the following example where we query for all employees who are born in the same month as today i.e.  in the month of July.   var employees = from e in scope.Extent<Employee>()                           where e.BirthDate.Month == DateTime.Now.Month                           select e;   As you can...
    May 27, 2021 2 min read
  • Productivity

    Using Interceptors with Ado.Net Data Services and Telerik OpenAccess ORM

    ADO.NET Data Services enables an application to intercept request messages so that you can add custom logic to an operation. You can use this custom logic to validate data that goes to the client or returns to be persisted on the server. You can also use it to modify and filter further the scope of a query request, or add in that way a custom authorization policy on a per request basis. Interception is performed by specially attributed methods in the data service. These methods are called by ADO.NET Data Services at the appropriate point in message processing. Interceptors cannot accept...
    May 27, 2021 2 min read