Sunday, February 24, 2013

What is New in Entity Framework 5 ?

Introduction
  • Here I am explaining the newly released Entity Framework 5 New features and about the significant performance improvements of the Latest Entity Framework 5 

What is New in Entity Framework 5 ?

    1. Enum Support 
             - allows you to have enum properties in your entity classes (Click for More ...)

    2. Spatial Data Types
             - can now be exposed in your model using the DbGeography and DbGeometry
               data types (await for next post ...)

    3. Performance Enhancements

        i. LINQ to Entities Query Repeat Execution Time
           - repeat execution time of the same LINQ query has been reduced by around 600%
           - by using automatic compilation of LINQ to Entities queries

                    What is automatic compilation ?
                         - now every LINQ to Entities query that you execute automatically
                           gets compiled and placed in EF’s query cache
                         - each additional time you run the query, EF will find it in its query cache
                            and won’t have to go through the whole compilation process again

                    Behind the scene of Auto-Compiled Query Process in EF 5


Behind the scene of Auto-Compiled Query Process in EF 5

               Performance gain of EF 5 Hence Auto-Compiled Query Process

 Performance gain of EF 5 Hence Auto-Compiled Query Process

           
        ii. End-to-End Performance
                - performance tests that run a variety of operations designed to simulate the
                   typical usage a real-world application
                - then 67% performance increase over EF 4
                - just by upgrading the server to EF 5

"We aren’t done improving performance yet, but we’re excited about how much faster EF 5.0 is"
- The Microsoft Entity Framework Team

     4. Code First will now detect if you have LocalDb available for creating new databases
             - visual studio 2012 includes LocalDb

                     What is LocalDb ?
                        - Microsoft SQL Server 2012 Express LocalDB is an execution mode
                          of SQL Server Express targeted to program developers
                        - LocalDB installation copies a minimal set of files necessary to start the
                          SQL Server Database Engine


     5. Code First will add tables to existing database
            - if the target database doesn’t contain any of the tables from the model


What is New in Entity Framework Designer in Visual Studio 2012 ?


     1. DbContext code generation for new models
           - means that any new models created using the EF Designer will generate
              a derived DbContext and POCO classes by default
           - you can always revert to ObjectContext code generation if needed
           - existing models will not automatically change to DbContext code generation

     2. Multiple-diagrams per model
           - allows you to have several diagrams that visualize subsections of your overall model
           - shapes on the design surface can also have coloring applied

     3. Table-Valued functions
           - in an existing database can now be added to your model

     4. Batch import of Stored Procedures
          - allows multiple Stored Procedures to be added to the model during model creation


How to Install Entity Framework 5 for Visual Studio 2012 Solution ?


Step 1. Open Visual Studio 2012 with Your project

Step 2. Right Click Your Solution and then Click Properties

Click Properties


Step 3. Double check whether Your Target Framework is 4.5

Double check whether Your Target Framework is 4.5


Step 4. Right Click Your Solution and then Click Manage NuGet Packages... 

Manage NuGet Packages


Step 5. Click Online Tab and Then Type Entity Framework 5 on Search Box
            After that Select EntityFramework and Click Install 

Click Install

Step 6. Click I Accept

Click I Accept


Step 7. Finally, Close the Manage NuGet Packages Screen


That's It.You're Done.

Entity Framework 5


Conclusion
  • You saw that how much of performance gain could be achieved by just updating the Application Server for Entity Framework 5 Out of the box without doing anything to your existing Linq to Entity Queries
  • It's Simply Amazing
  • So Try to use EF 5 with your projects and Enjoy it

References
Improve Performance with Entity Framework 5

I hope this helps to You.Comments and feedback greatly appreciated.

If you feel it was a good article,Give me a +1.Thank You.




You Might Also Like

How to Improve Performance of Entity Framework Query ?

14 comments:

  1. hi Sampath, yes EF 5 is beautiful, great post.

    -Franco Candieracci-

    ReplyDelete
  2. Nice to have the features at a glance.
    Useful one.
    Thanks,
    Aref

    ReplyDelete
  3. I know this if off topic but I'm looking into starting my own blog and was wondering what all is needed to get setup? I'm assuming having a blog like yours would
    cost a pretty penny? I'm not very internet savvy so I'm
    not 100% sure. Any tips or advice would be greatly appreciated. Appreciate it

    my web blog :: http://wiwt.com

    ReplyDelete
    Replies
    1. Hi,

      Thanks for feedback.
      Here I am using Blogger.So If you need you can create it by using below mentioned link.
      https://accounts.google.com/SignUp?service=blogger&continue=http%3A%2F%2Fwww.blogger.com&hl=en

      Or You're having another option also that is WordPress Blog.Check below link for that.

      http://www.siteground.com/tutorials/blog/wordpress.htm

      Good Luck !

      Delete
  4. Excellent items from you, man. I have be mindful your
    stuff previous to and you are just too great. I really like what you have
    obtained here, really like what you're stating and the best way through which you say it. You make it enjoyable and you still take care of to stay it sensible. I can not wait to learn far more from you. That is really a tremendous website.

    Take a look at my page; zulutrade

    ReplyDelete
  5. Replies
    1. Hi Shailendra,

      Thanks, I’m glad you enjoyed it!
      Keep in Touch.

      Delete
  6. Sampath Lokuge

    This is even better than Entity Framework:
    https://www.kellermansoftware.com/p-47-net-data-access-layer.aspx

    ReplyDelete
    Replies
    1. Hi Asava,

      Thanks for the useful link about another ORM API.
      Keep in Touch.

      Delete

Thanks for your Feedback.