Entity Framework 4 vs Dataset

Posted on 2011-04-25
Last Modified: 2013-11-12

I'm looking to put together a decision tree, pros and cons, type of document regarding .NET 4 Entity Framework vs Datasets.

Can you please share your decision strategy or point to some interesting sources?

Thanks very much,
Question by:Bill732
    LVL 24

    Expert Comment

    LVL 16

    Expert Comment

    by:Imran Javed Zia

    Author Comment

    Hi hes,

    Thanks very much for responding. Yes, I saw that one, it was a good thread.

    So these observations seem in the right direction?:

    Datasets are best when you want to bring down most of your data (disconnected) to a desktop client, as in WPF, to work with and so reduce your trips to the dataserver. But they can be more difficult to maintain as the data configuration changes.

    EF 4 models are easier to maintain as the data changes but there is an overhead performance hit that maybe noticeable in the application (translating the data into the data model each time). Also there will be more trips to the data server (but for smaller amounts of data) but you can use a caching scheme to have it perform more like the disconnected datasets.

    Author Comment

    Hello IJZ,

    Yes, I saw those, thanks! I also saw a good video presentation from teched 2010 that said Datasets are not going away, but Microsoft is encouraging developers to use EF4 with new applications.

    I have used datasets and found some nice things, such as how easy it is to implement sorting with the table adapter; using the relations between tables, and having the data available on the client.

    I have not used EF 4 yet. I believe it will be a little more work to implement the sorting but not a show stopper. I don't know yet about implementing disconnected data scenario. It also looks like there are really nice features that will cut down on development and maintenance time.
    LVL 13

    Expert Comment

    I never used Entity Framework, but I can say you my experience.
    I think that most of the times the best solution is in the middle.
    You will hear that Dataset is "expensive" (and I think it too, because it keeps in memory the previous version of the rows, you usually do not need it).
    But I sometimes use Datasets (or better, Datatable) for my little-onetime-objects. I use them when I don't want (need) to create a Class (entity, I say) describing that object.

    The solution for me is to manually create entities as the optimized way to work with my data.
    Then use Datasets when I don't need entities (for example, if I need to fill a dropdown box with static values).

    My thinking is that being "radical" can easily be the worst choice.
    Allow your code to be "standard", but at the same time try to take the advantage of new technologies.

    Hope this helps.

    Accepted Solution

    I need close this question. I appreciate the responses with the links, but I was hoping for someone to provide their own experiences with EF4.

    I have now used EF4 and find it to be the preferred way to go when creating MS object oriented applications.

    Author Closing Comment

    I need close this question. I appreciate the responses with the links, but I was hoping for someone to provide their own experiences with EF4.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now