2

I have gone through an article of using EntityConnection, EntityCommands for executing Entity sql queries. But I was unable to understand that Why are we using Entity sql? Why not directly using the Classes and objects for processing CRUD operations on database?

Or If we want to execute sql queries then why we are using Entity Sql , why not directly Ado.net ?

Is there any performance difference or something else? I have already gone through the page http://msdn.microsoft.com/en-us/library/bb738573.aspx. But I want answer in a more simpler way. Can you please answer me?

Thanks

2 Answers 2

3

Why not directly using the Classes and objects for processing CRUD operations on database?

That is (should be) the way for almost all operations. But sometimes there is a need for accessing the db more directly and precisely.

If we want to execute sql queries then why we are using Entity Sql , why not directly Ado.net ?

E-SQL will still let you work with entities (instead of Rows). This is much easier and more powerful, consider inheritance for example.

E-SQL is also supposed to be independent of the actual database, ie the same for Oracle etc. I have no experience with this yet.

Is there any performance difference or something else?

It can be used to improve performance, yes. But not automatically.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Henk, thanks for the beautiful answer. can you please explain "E-SQL will still let you work with entities (instead of Rows)" that you have used in your answer?
Like I said, data is returned as objects. And you can use TypeOf<T> in queries.
3

The main difference

  • SQL is database dependent query language working on storage (relational) objects - tables / rows
  • ESQL is database independent query language working on conceptual (EDMX) objects - entities

ESQL was created prior to LINQ. In some scenarios ESQL offers more functionality than LINQ.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.