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
Related
I have a spring project with many Entities and a complex relationship between entities. I would like to automatically find the indexes that are missing so that I could create those indexes. Are there any tools that help in achieving this? We are using Hibernate ORM and Oracle Database.
There is a new useful feature in Hibernate: SLOW_QUERY_LOG(LOG_QUERIES_SLOWER_THAN_MS). It would help you if it really worked (HHH-13928)
There is cool (but very expensive) tool Dynatrace, which can tell you relation between a slow REST API call and particular slow SQL
And then there are Oracle's native tools like Diagnostic pack and Tunning pack. But those will not show you relation between slow SQL and piece in you code which called it.
There is common issued when there are missing indexes on FK keys. In most cases those are a must. https://www.orafaq.com/node/2935
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.
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.
what is the difference between LINQ and ADO.net
Linq is a language feature (Language INtegrated Query) that allows for querying of objects. It is often conflated with Linq to Sql, which is a series of extension methods and other code that allows querying of a Sql Server database using Linq statements.
You can write a Linq provider to query any kind of datasource, for example, there is a Linq to Amazon provider that allows you to retrieve results from Amazon's public API.
ADO.Net is series of technologies for retrieving data, I suggest starting here: http://en.wikipedia.org/wiki/ADO.NET
I think you probably mean LINQ-to-SQL. ADO.NET is the bare bones of talking to a Database, so you need to set up the DataTables, DataReaders, etc. yourself. This includes iterating through our tables, setting up your connections, transactions, etc.
LINQ-to-SQL is an ORM (Object Relationship Mapper) which allows you to view your data as business objects, instead of collections of data in DataTables. LINQ-to-SQL works with ADO.NET under the hood. Much easier!
LINQ is the expression syntax used by LINQ-to-SQL to query tables, eg
ClientSet.Where(q=>q.ID==1).First();
LINQ to SQL actually stands for LINQ to 'databases that use SQL' or in other words LINQ for the relational data model. LINQ to Entities means LINQ for the Entity-Data-Model which is a kind of a relational++ model.
More info:
http://blogs.microsoft.co.il/blogs/gilf/archive/2008/04/20/linq-to-sql-vs-entity-framework.aspx
ADO.NET
It is a part of .NET Framework since .NET Framework 1.0
SqlConnection/OleDbConnection is used for database connectivity.
Difficult to debug and cause syntax errors at run-time.
It has full type checking at run-time and not IntelliSense support in Visual
Studio, since it used the T-SQL to query the database.
LINQ
It is a part of .NET Framework since .NET Framework 3.5
We can use context for database connectivity.
Easy to debug and cause syntax errors at compile-time.
It has full type checking at compile-time and IntelliSense support in Visual Studio, since it used the .NET Framework languages like C# and VB.
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