Support for special hierarchical queries
Support for special hierarchical queries
Hello,
I've been using the latest dotConnect for Oracle suite. Whenever i need to use the special Oracle hierarchical queries, i need to revert to plain old SQL syntax. Nevertheless, this syntax is not reusable in other databases. I do not know about the syntax of specific hierarchical queries in other databases like MySQL and MS SQL Server, but i guess there should be a similar support.
It would be great if i could use Devart's dotConnect for MySQL, MS SQL Server and Oracle, interchangeably, using the same LINQ syntax for my hierarchical queries through my application without the need to change code, or compile conditionally or maintain the DB type as parameter etc...
I've been using the latest dotConnect for Oracle suite. Whenever i need to use the special Oracle hierarchical queries, i need to revert to plain old SQL syntax. Nevertheless, this syntax is not reusable in other databases. I do not know about the syntax of specific hierarchical queries in other databases like MySQL and MS SQL Server, but i guess there should be a similar support.
It would be great if i could use Devart's dotConnect for MySQL, MS SQL Server and Oracle, interchangeably, using the same LINQ syntax for my hierarchical queries through my application without the need to change code, or compile conditionally or maintain the DB type as parameter etc...
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Purpose for the use of such queries is efficiency and performance. Instead of making recurrent queries in each level of a hierarchy, a single query can return the requested data.
Examples of use are:
1). Get the entities of the hierarchy in which a specific entity belongs. Get only the ascendants or only the descendants or the full hierarchy.
2). Get the root entity of the hierarchy in which a specific entity belongs.
In almost all the queries, the returned result can be the whole entity or list of entities or a subset of the properties.
The use of the Level of an entity in a hierarchy is paramount to all these queries. The Level should be available in projection methods as well as in ordering the result set according to it.
It is apparent, that the LINQ approach offers the extra value of DB-agnostic implementation. I need to be able to attach my solution to a SQL Server as well as to an Oracle database. For now, my code is polluted with hundreds of non-LINQ, pure SQL string based hierarchical queries surrounded by the required switches based on the type of connected DB.
As you can see, this is way far from the relevant features on which you base the advertisement of the LinqConnect product...
Examples of use are:
1). Get the entities of the hierarchy in which a specific entity belongs. Get only the ascendants or only the descendants or the full hierarchy.
2). Get the root entity of the hierarchy in which a specific entity belongs.
In almost all the queries, the returned result can be the whole entity or list of entities or a subset of the properties.
The use of the Level of an entity in a hierarchy is paramount to all these queries. The Level should be available in projection methods as well as in ordering the result set according to it.
It is apparent, that the LINQ approach offers the extra value of DB-agnostic implementation. I need to be able to attach my solution to a SQL Server as well as to an Oracle database. For now, my code is polluted with hundreds of non-LINQ, pure SQL string based hierarchical queries surrounded by the required switches based on the type of connected DB.
As you can see, this is way far from the relevant features on which you base the advertisement of the LinqConnect product...
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48