Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use LINQ without Entity Framework?

Tags:

c#

sql

linq

ado.net

I am working on an old application which uses a 3 thier approach, however the connection to the database is made via a connection string only and data is manipulated through sql stored procedure.

Is it possible to use LINQ without adding an ADO.NET entity model?

like image 645
user1986761 Avatar asked Jul 23 '13 13:07

user1986761


People also ask

Can we use LINQ without Entity Framework?

LINQ to Objects, for instance. But are you asking if you can use LINQ to operate on the database directly without setting up any type of entity model? No, not really. Maybe you're a candidate for Entity Framework Code First, but its a little hard to tell based on your description of your setup.

Is LINQ part of Entity Framework?

LINQ to Entities provides Language-Integrated Query (LINQ) support that enables developers to write queries against the Entity Framework conceptual model using Visual Basic or Visual C#. Queries against the Entity Framework are represented by command tree queries, which execute against the object context.

Is Entity Framework and LINQ the same?

Entity Framework is an object-relational mapping (ORM) framework for connecting C# code to external databases, usually SQL Server. LINQ is a query language embedded into C# and a set of extension methods in order to make it useful.


2 Answers

LINQ itself can be used without the database stuff. LINQ to Objects, for instance. But are you asking if you can use LINQ to operate on the database directly without setting up any type of entity model? No, not really. Maybe you're a candidate for Entity Framework Code First, but its a little hard to tell based on your description of your setup.

like image 107
Tim Avatar answered Sep 30 '22 04:09

Tim


Linq as in linq-to-sql/linq-to-ef, which means that the SQL will be generated based upon your expression? No.

Linq as in query over the data-in-memory that was loaded using your stored procedures (which means that your queries won't be translated to SQL)? Yes.

like image 35
Maarten Avatar answered Sep 30 '22 04:09

Maarten