• .NET

    Altering OQL queries to generate different JOIN clauses in SQL

    As most of you probably know, OQL was the main object-oriented query language that was supported by Telerik OpenAcess ORM before Linq was introduced in .NET. Even though Linq is now the de facto standard for querying data, support for OQL is still there and I would state that it still is pretty convenient to use in some scenarios. We will use this post to share some tips on querying data using the Object Query Language. Consider the following query: IQueryResult projection = scope.GetOqlQuery("SELECT pr.ProductName, cat.CategoryName " + "FROM CategoryExtent AS cat,cat.Products AS pr").Execute();  This query makes...
    September 24, 2009
  • .NET

    LINQ Tip of the week: System.DateTime support

    Continuing with the LINQ tips, today we provide a list of System.DateTime properties and methods that are supported by the Telerik OpenAccess ORM LINQ implementation. The table below provides the equivalent SQL function call for every member.   Please note that the table lists the MS SqlServer specific SQL translation.   Properties DateTime.Day DAY(date) DateTime.Hour DATEPART(hour, date) DateTime.Millisecond DATEPART(millisecond,date) DateTime.Minute DATEPART(minute, date) DateTime.Month MONTH(date) DateTime.Second DATEPART(second, date) DateTime.Year YEAR(date)   Static Methods DateTime.Parse(String) value is parsed on the client side and the result is pushed to the server as filter DateTime.Parse(String,IFormatProvider) value is parsed on the client side and the result is pushed to the server as filter DateTime.Parse(String,IFormatProvider,DateTimeStyles) value is parsed on the client side and the result is pushed to the server as filter   The various comparison operators...
    September 16, 2009
  • .NET

    Customizing the behavior of persistent collections

    As most of you may already know, Telerik OpenAccessORM uses the TrackedList<T> to manage the collection fields of its persistent classes. The objects that belong to such collection are in a 1-n relation with the parent object that ‘owns’ the collection. Before getting to the point of this post, let me put few words about the behavior of the TrackedList<T>. When a new object is added to a TrackedList<T>(ex: order.OrderDetails.Add(someDetail) ),Telerik OpenAccess ORM persists that object to the database. The new object has a reference to the owner of the collection to which it was added.  When one removes an object from...
    September 11, 2009
  • .NET

    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...
    September 03, 2009
  • .NET

    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...
    September 01, 2009