Telerik blogs
  • Productivity

    Using Distributed Cache with Telerik OpenAccess ORM

    Telerik OpenAccess ORM maintains several cache levels that can be used in various application scenarios. While the L1 cache is specific for each object scope, the L2 cache works on higher level as it is common to all object scopes in an application. But what if we want to have the cache working even on higher level – to be shared between many applications? The feature that has to be used in such scenarios is the L2 Cache Cluster. It provides the ability to synchronize the L2 caches of many applications that operate on the same database. To achieve this, each modifying transaction...
    May 27, 2021 2 min read
  • Desktop

    Per-request object scope vs shared one

    Quite some people have been wondering – why does the Telerik OpenAccess ORM team suggest using a separate object scope per every HttpRequest in a web scenario or on a thread level in desktop apps. Doesn’t this lead to many set-backs? What happens with change-tracking, optimizing the DAL using cache, synchronization.. This post will be dedicated to explaining why the per-request approach is not only the better, but the obligatory one in most of the cases. Usually data-modifications are transaction-bound in 99% of the cases. When the scenario does not allow that e.g. we need several requests to do...
    May 27, 2021 2 min read
  • Productivity

    LINQ Tip of the week: System.String support

    Welcome back for some more information about the Telerik OpenAccess ORM support for LINQ. Today we provide a brief list of the System.String properties and methods that are supported by our LINQ implementation. When any of the below listed methods are used in a LINQ query, Telerik OpenAccess ORM translates the method call to equivalent SQL which is then executed on the server. Please note that the table lists the MS SqlServer specific SQL translation.   Properties String.Length len (string_expression)   Methods String.CompareTo expression = expression String.Contains match_expression LIKE pattern String.EndsWith match_expression LIKE pattern String.Equals expression = expression String.IndexOf(String) CHARINDEX (expression1,expression2, –1) String.IndexOf(String,Int32) CHARINDEX (expression1,expression2, start_location) String.Insert CASE   WHEN( LEN(ISNULL(column_name,'')) = start_index) THEN ISNULL(column_name,'') + value ...
    May 27, 2021 1 min read
  • Productivity

    Using the ObjectScope events

    Telerik OpenAccess ORM ObjectScope comes packed with all the events that are needed for managing the lifecycle of your persistent objects. You have events for Add, Remove, Refresh and Update actions. They come in –ed and –ing flavors which would mean that you can successfully iterate with your data before the changes have been made (-ing events) and after the changes have been done(-ed events) . You can subscribe to any or all of them and successfully perform some business logic over your persistent objects. Here is a basic implementation of a generic (in terms of availability for both ObjectScope and ObjectContainer)...
    May 27, 2021 2 min read
  • Productivity

    LINQ Tip of the week: LINQ and Anonymous types

    Today we have a closer look at using LINQ and anonymous types and it's pros and cons. Consider the case where we want to obtain a subset of data instead of an entire persistent instance. For example, if we want to obtain the contact details of all Customers based in London we would use the following query var query = from c in scope.Extent<Customer>()                    where c.City.Equals("London")                    select new { c.City, c.Address, c.ContactName };   Notice the last line in the above query - select new { c.City, c.Address, c.ContactName } This line creates an anonymous type. Behind the scenes, at compile time, a very simple class is generated automatically. In this case, three...
    May 27, 2021 3 min read