I can connect with the DataContext to the Oracle database however I get errors in running the query against the oracle database. I looked at the SQL generated and it is for MSSQL and not Oracle PSQL.
Does anybody know of a decent easy to use wrapper to use LINQ against an Oracle Database?
No, LINQ to SQL is very much MS SQL only - think of it as a client driver.
Microsoft is/was helping Oracle and DataDirect develop providers for Oracle and other non-MS database servers.
We use the OraDirect driver from Devart. It includes ADO.NET Entity framework support. You can download a trial version here. You may then use LINQ to entities or entity SQL on top of this.
The pricing of this is quite developer friendly, you pay per developer seat and you may use it however you like.
Another big advantage of this driver is that you can use it without installing an Oracle client, this is a big plus and worth the price alone.
#Greg: We evaluated the datadirect drivers as well, but the performance was poor and cost astronomical.
Edit: It seems DevArt announced a beta with LINQ support recently
One thing you might look into is that there is now LINQ to Entities, which leverages the MS Entity Framework, which I believe is DB agnostic. I'm still looking into how it works myself, but if you could create an ADO.NET Data Entity that interfaces with Oracle, you could then use LINQ against that Entity.
There's also Lightspeed which has a per-organization (not per-developer) license scheme and seems to have a pretty solid documentation library and a free trial version (up to 8 entities). I'm checking this out presently.
After a long search I found DbLinq and should do the trick. I am going to try it myself. I came across your question because I was searching for the same solution. Hope it helps.
Do look at Linq to entities though. I have a datareader populate a collection of objects that are mapped to the oracle table. I can use linq to query that collection in very powerful, simple, and easy ways. I love it. Highly recommend.
Try Devart LinqConnect. This product allows you to work with Oracle, etc.
Why not try ALinq ? http://www.alinq.org
Look in codeplex:
Linq To Oracle project
Not an easy way, at least until a good provider is produced.
Really MS should provide at least an OLEDB Linq provider. After all, Linq to Sql is basically an implementation of IQueryable with designer support.
Another cross-database solution that works fairly well across Oracle, SQLite, MySQL and SQL Server is eXpress Persistent Objects
Related
I need to develop a program that must delete and insert data into an Oracle database. Is it possible to use LINQ to SQL with Oracle?
For development I use MS SQL server but it will be a Oracle database in production. What do you recommend?
Officially No. Linq to SQL was originally build with the ability to swap out the data provider to allow connections to other databases, but they disabled this functionality in the released versions to encourage people to use more stable and supported data access layers (like EF). The recommended approach is to use Entity Framework if you want to switch between SQL and Oracle.
Also, Patrick is very right, make sure you are developing and testing against the same database platform you are going to use in production, there is a world of difference in how they operate. Sure, you should be able to abstract it away to not care about whether you are using SQL or Oracle, but that is almost never really the case.
No, you can't. Although LINQ to SQL was initialy designed with multi-database support in mind (you can see this when looking at the code using .NET Reflector) using a provider model, this model was never made public and Microsoft has no intensions in adding multi-database support to LINQ to SQL.
If you need multi-database support, please use Entity Framework.
No, LINQ-to-SQL doesn't support Oracle. Internally, the project had support for multiple back-ends, but this never made it into the final public release. I believe LINQ-to-Entities supports other databases.
As a predefined conditions I have multiple database sources to deal with.
Also I have a UDT – user defined types objects in part of this databases ( the UDT’s also have children inside) .
As a methodology I am a believer of using the ORM-object relational mapping to connect to DB’s .
In the past I’ve successfully implemented Fluent NHibernate library to connect to Oracle.
I’ve found a workaround for the Multiple Databases , even though the solution may be more elegant in future.
Nevertheless , I still can’t find a solution for mapping the UDT’s .
I think that it should be something like implementation of IUserType or ICompositeUserType .
If there is a known framework presenting option for a full ORM , including UDT’s handle it also can be a solution in our case.
I’ve checked out the EF of oracle (that is very premature) and also DevArt (that doesn’t handle UDT’s) as a possible solutions.
The ODP.Net is the only possible way right now and it’s not too friendly for the developers to use – no LINQ support , no context to begin with.
If you or any of your colleagues can help with some samples of the implementation of this kind of mapping it will be very appreciated.
I feel your pain, working with ODP.NET is not a pleasant experience at all. DevArt dotConnect supports UDT's. DevArt Objects documentation
the question is basically in the title. Also if anyone has started some kind of implementation but never finished it and is willing to share it, I'm interested! :)
Or if it is being used internally in an open-source project...
I found this while looking for something similar.
Quoting the other post:
Incase anyone is interested.
I'm building a Linq provider for XML columns in sql server.
The Linq provider will translate the query into sql server compatible XQuery code.
Info
Code
This allows you to use sql server like a schema free document DB a'la NoSQL.
Altough the usecase here is not scale but rather the joy of persisting unmapped entities and versioned entities.
Are there any known issues of EF usage with Oracle database? Are there any key points I should specially pay attention? Share your toughts and experience please?
Devart dotConnect for Oracle allows you a direct access to the Oracle database without Oracle client installation.
You will need to use a 3rd party EF provider to talk to Oracle, this may cost money.
All of the EF examples asume you are using Sql Server
Most EF implementations for Oracle require the deployment of the Oracle client in order to use some or all of the available features. Look for an implementation that is 100% managed for support of all features in order to avoid the performance bottlenecks, memory leaks, and deployment headaches this type of implementation can cause.
What is the differences between those 2 assuming I'm using SQL Server as my database? Are they the same?
This post points to some info. in particular 3 main differences:
The ability to query relational stores other than Microsoft SQL Server
A full textual query language not limited to LINQ's language support
Advanced mapping facilities, such as mapping a single class to multiple tables
Long answer: google.
Short answer: using entity framework, you will be able to create something based on classes (partial, that you can "extend") resembling domain objects (not true DDD though, that's why NHibernate still exists and linq to nhibernate is being developed), using sql you will be just thinking database and tables.
The Dec 2008 issue of Visual Studio Magazine cover story by Roger Jennings is a good read on the topic, with some L2S vs EF side-by-side comparisons:
http://visualstudiomagazine.com/features/article.aspx?editorialsid=2583