Results 1 to 5 of 5

Thread: Entity Frame Work

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Entity Frame Work

    what are the pros vs cons in using entity frame work, from the research i have done it looks like Microsoft is pushing in favour for this platform. i have had a discussion in this regard with a senior developer and he recommended against it, and his argument was that adding new columns to datatable will require regenerating entities what makes it a big hassle !
    i will be starting a project and need to decide which direction to go, and then learn the technology. any recommendations ? Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Entity Frame Work

    If you use EF and you have deployed your app and then you want to add a new column to your database, you will need to regenerate the data model, rebuild your project and redeploy. That's true of basically any data model though, including typed DataSets and any other ORM that I'm aware of. It's almost impossible to create an application of any complexity that isn't dependent on a specific database schema so a database schema change will require a rebuild and redeploy for pretty much any application. If you have used raw ADO.NET with a "SELECT *" query, bound the results to a DataGridView with auto-generated columns and then used a command builder to save the data then you might get away without it but using data in an app like that would be very difficult except at the most basic level.

    Assuming that you do have to make changes to the app for a new database column anyway, nothing could be easier than EF in that situation. You simply open the model in the designer, right-click and select a menu item. A couple of seconds later the model is updated and you're done. We use EF for everything we can here. It's not perfect but nothing is. It's flexible enough to allow you freedom where you need it, e.g. you can write your own Entity SQL in situations where it's hard to do what you need using LINQ to Entities.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Entity Frame Work

    One thing that I will add is that you should ALWAYS inspect the SQL code generated by EF as it will not always be what you expect. Many times you can improve the SQL by changing your LINQ to Entities code a bit. There are times that you simply can't get EF to generate as efficient SQL as you could write yourself but there's always a trade-off. Usually it's not enough to really matter.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Re: Entity Frame Work

    Thanks for the clarification , would be great if you could recommend a good book or on-line resource to learn EF and LINQ to EF ? Thanks again

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Entity Frame Work

    I'm afraid that there's no one specific resource that I'm aware of. I've picked up bits and pieces from various places over time. I always use MSDN first but I'll often look further afield afterwards.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width