what is the difference between LINQ and ADO.net - linq

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.

Related

why dapper ORM is so fast by comparing Entity Framework and ADO.NET?

Please mention the reason of Fast execution of dapper ORM by comparing Entity Framework and ADO.NET. I got the reference for comparison from the link dapper vs entity framework
It can never happen that Dapper is much faster than ADO.Net. Period!
We know that Dapper team has written an advance mechanism via IL to just speed-up the process, but still it is running on top of ADO.Net. They are only abstracting the ADO.Net and processed everything on top of it by converting the actual data (rows) back to the object models (POCO or DTO), and that would add additional time doing it.
I think everyone must understand the separation of concern of the ADO.Net layer from any other ORM available on this world.
Or else or unless, the Dapper team will write their own version of DbDataReader, then, there could be a possibility that they are much faster, but never ever it will happen until they do it.
With EF, there is no question that Dapper is much faster than it as they are the most lightweight ORM right now that is available.
IMHO

Is it possible to use LINQ to SQL with Oracle?

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.

MVC + ORM, generating reports

I've just started using Zend Framework and Doctrine as its ORM, and I have some doubts regarding the model. It's obvious that the purpose of the ORM is just to map my domain model to database model, but I'm curious how you would model various reports needed on a Web application?
From my point of view, and correct me if I'm wrong, I should avoid writing any queries in the controller (Doctrine Query Language queries, in this case). So, if I want some arbitrary report (e.g. revenue per department, split by month), should I have a special reporting "service" in the domain? This service would fetch my report from the database using ORM queries.
If you could shed some light on this topic, I'd be grateful.
For sure, sometimes DQL is insufficient. In Doctrine2 you can extend it. But Doctrine 1.x is not stupid and you can use native SQL with it: http://www.doctrine-project.org/projects/orm/1.2/docs/manual/native-sql/en
If ORM is insufficient, you can use native SQL. Reporting is the case where SQL queries become tooo complex for ANY simple QL you can image. So... I say go for native queries if you can't avoid it. But save Doctrine for everything else.

Linq to SQL and Entity Framework differences?

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

Is there a Way to use Linq to Oracle

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

Resources