Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In what situations should I use Entity SQL?

I was wondering whether there are situation that's more advisable to use ESQL?

Generally, I find ESQL frustrating (specially with all the special cases where you need to fully qualify an entity type) & probably anything done using ESQL can be done through SQL or LINQ.

But I was wondering of situations where ESQL is a better fit for a solution or would have a competitive edge over using SQL or LINQ (either easier/faster to code, or better performance, etc.)

So, what's the compromise here? When is it better to use each one of the three approaches in querying over EF4?

like image 219
Shady M. Najib Avatar asked Dec 04 '10 20:12

Shady M. Najib


People also ask

When should I choose Entity Framework?

The Entity Framework enables developers to work with data in the form of domain-specific objects and properties, such as customers and customer addresses, without having to concern themselves with the underlying database tables and columns where this data is stored.

When we should not use Entity Framework?

One of the biggest reasons not to use Entity Framework Core is that your application needs the fastest possible data access. Some applications do a lot of heavy data operations with very high-performance demands, but usually business applications don't have that high of a performance demand.

What is an Entity SQL?

Entity SQL is a SQL-like language that enables you to query conceptual models in the Entity Framework. Conceptual models represent data as entities and relationships, and Entity SQL allows you to query those entities and relationships in a format that is familiar to those who have used SQL.

What is the key advantage of using Entity Framework?

What are the advantages of the Entity Framework? Entity Framework helps to reduce development time and development cost. It provides auto-generated code and allows developers to visually design models and mapping of databases. It allows easy mapping of Business Objects.


2 Answers

I find that ESQL to be good for edge cases, for example:

  1. Where it's just really hard to express something in LINQ.
  2. For building very dynamic searches.
  3. If you want to use a database specific function that is exposed by the provider you are using.

Also, if you know Entity SQL, you will be able to express QueryViews and Model-Defined Queries.

like image 104
Julie Lerman Avatar answered Sep 20 '22 16:09

Julie Lerman


I came across these pretty similar questions (which didn't show up when I typed mine, earlier) on stack over flow, I guess they have deeper discussions (though T-SQL is not mentioned a lot, but it's kinda pretty obvious though):

Note that the two questions are a bit "old" so you might validate some of data based on your current understanding of EF4

like image 41
Shady M. Najib Avatar answered Sep 21 '22 16:09

Shady M. Najib