Difference Between Entity Framework And Stored Procedure

Entity Framework

  • Entity Framework is using linq query to write the database operation.

  • By using linq queries, we are writing common query across all the data sources, regardless of its data source.

    a.We are writing same styled syntax for any type of database like Sql server, Mysql, Orracle etc.
    b.So LINQ query provide a uniform programming model.

  • LINQ query provide compile time error checking. We can watch the spelling and syntax while we write queries in linq.

  • LINQ query provides intellisense feature, means by writing one letter all the keyword corresponding to that letter or word appears in the visual studiointellisence window.

  • If there is any change in the database, table, column or datatype then you have to change or Update the Model.edmxfile.

  • Bu using Model designer we can see the Entity relationships visually, means which table is related to which table.

Stored Procedure

  • A Stored Procedure is aprecompiled object, when a statement is executed, it actually doing two things one is Compilation and second is Execution.

    a. Thus a Stored Procedure is in precompiled state it is only about to execute, that why it is taking less time to execute.

  • In Stored Procedure, SQL Queries can be saved and the same stored procedure will be used multiple times, until the target table is not changed.

  • Stored Procedure is using parameterized query, that why it avoid Sql-Injection attacks.

  • Stored Procedure is using dynamic sql query syntax.

  • Store Procedure is faster than the LINQ query.

  • Stored Procedure is good for writing more complex database queries.

  • If there is any change in the database, table, column or datatype then you have to change or Update the Stored Procedure.
Ebook Download
View all
Learn
View all