Oracle with IQueryable - oracle

I was having a bit of trouble figuring this out so I thought I'd ask explicity...
Does oracle's ODP.Net or ODT entity framework support IQueyable - ie. If I create simple paging or query in linq will it run the query on the database?
I'm roughly aware that there are commercial products that will work with oracle to do this - I see DevArt pop up quite a bit.
Thanks,
Sam

You can use NHibernate to run LINQ queries against Oracle database.
NHibernate uses it's "language" called HQL to talk to various databases. And they also built LINQ provider that creates HQL that is in the second phase sent to target DB.

After a bit more searching, it appears the ODP.Net will convert queries into SQL code, but ... poorly on occasion?
see
https://community.oracle.com/thread/2598619
for details & more relevant resources see
https://community.oracle.com/community/developer/english/oracle_database/windows_and_.net/odp.net/content
& enter tag "paging"
According to the last comment in the thread https://community.oracle.com/thread/2349719, linq actully generates the SQL.. interesting

Related

Independence though ODBC drivers

Can an application developed with oracle queries in DB layer
Be run on an SQLServer Database with the help of an ODBC driver
Maybe, if you used only ANSI SQL statements. ODBC will happily send the text of the query to the query parser on the server and as long as the server can parse it, it will run.
If, however, you have used anything that's specific to Oracle (and that's a long, long list), then it won't work so well.
All that ODBC provides you is abstraction from the connection details -- the driver, the server name, the port numbers etc.
So, how do you get true independence? Generally, you'll use a query generation library like Hibernate which knows how to translate a query language of some kind (HQL) to the specifics for that particular database (PL/SQL or Transact/SQL).
Short answer: Not reliably.
Longer answer: Not through ODBC, but using a JDBC driver for Microsoft SQL Server then perhaps if the application was developed only with ANSI standard SQL. Usually, that is not the case and some PL/SQL code will have been used. If an equivalent piece of T-SQL can be written then it is possible to port the application. But, to your question, this is largely immaterial to the database connection mechanism.
Addendum: Object Relational Mapping tools usually use dialects to generate database independent queries. Other options include using configuration to select the correct queries at run-time (if you need to support both database types).

Cannot get Entity Framework 5 and Power Tools to work correctly with Oracle 11g

I know this question is similar to another one, but I have now tried both the Oracle data provider and the Devart (dotConnect) provider, and cannot get either combination to work well with our Oracle 11g database and the Power Tools "reverse engineer code first" feature.
With the Oracle provider, there was no way to specify a schema or subset of the database, and it cranked out almost 3,000 entity classes, even though the connection was specific to the target application. It grabbed all the Oracle system tables, etc., along with the application data tables.
With the Devart provider, I still could not specify WHAT to generate, and ended up having to kill it off after running for almost a day.
Anyone know how to get this stuff working with Oracle?
We have answered you about dotConnect for Oracle (Entity Developer) at http://forums.devart.com/viewtopic.php?f=1&t=27520.

how to write database independent layer using Linq

How I can write database independent, data layer using Linq to Sql? For example I have one dbml file, which I can use with almost any database at runtime ( by specifying web.config)
Entity framwork is a better option, but it is not implemented in Mono so I can't use it.
Edit: I mean different databases like Sql Server, Mysql or SqlLite. I prefer to use DbLinq for other databases.
Edit 2 :
I have created Linq to Sql mapping class by following this blog post.
http://blogs.msdn.com/b/spike/archive/2010/01/08/how-to-use-linq-to-sql-without-using-the-designer-generated-classes.aspx
Now how I can use this with other databases.
You need a 3rd party linq provider like ALinq http://www.alinq.org/ that suports Mono.
As it is structured from Microsoft, Linq to SQL is VERY database dependent, ie it only works with MS SQL. I believe that ALinq does work on mono. Here's a better list of 3rd party providers:
http://blog.linqexchange.com/index.php/links-to-linq-providers/

Linq dbml interchangeable between SQL Editions

I have a Desktop application that uses Linq To SQL as the DAL. It accesses a local SQL Express DB.
If I have a SQL CE DB that has the Exact same schema(table structure) can I re-use the generated dbml with just giving it a different connection string?
This article on LINQ To SQL on SQL CE from Matt Manela suggests that you could replace your SQL Server Express connection string with a connection string to SQL Server CE without any large issues. If it's just table-level querying that you're interested in, it sounds like you'll be in good shape.
He points out though, that CE handles connections differently than the larger SQL Server editions.
Without having tested it myself, I'd only want to determine if LINQ To SQL would ever generate any TSQL statements using keywords or features that SQL CE didn't support.
Also note, the current release does not support stored procedures or the XML datatype. It uses a subset of TSQL.
Best to visit the official .NET 3.5 SP1 LINQ To SQL for SQL Server Compact page at Microsoft.

SQL Server 2008 vs 2005 Linq integration

Linq To SQL or Entity framework both integrate nicely with SQL Server 2005.
The SQL Server 2008 spec sheet promises even better integration - but I can't see it.
What are some examples of what you can do Linq-wise when talking to a 2008 server that you can't when talking to SQL Server 2005?
This marketing link claims
"Write data access code directly against a Microsoft SQL Server database, using LINQ to SQL."
Which is basically untrue.
Linq To SQL is query comprehension translated into expression trees translated into SQL, optimized by the query optimizer and then run against SQL Server database. "directly" feh.
There is a problem of paging over a joined set that SQL 2005 mis-interprets.
var orders = (
from c in Customers
from o in c.Orders
select new {c, o}
).Skip(10).Take(10).ToList();
LINQ generates a ROW_Number against the joined set. SQL2005 generates a bad plan from that code. Here's a link to the discussion.
Edit#2: I'd like to clarify that I don't know that SQL2008 solves this problem. I'm just hopeful.
it has full support for the new data types. lol. beyond that you got me, other than possibilities of optimised queries (like the merge command, etc).
I am guessing most of it has to do on the server anyways. They probably optimized the query execution as for differences I don't know except for the new types.
Unless LINQ exposes the new MERGE statement, no.
There is little effective difference in the engines especially from an ORM/client view

Resources