none
What is the best way that choosing providers? RRS feed

  • Question

  • Dear master

    ado.net dataset vs ado.net entity framework vs linq to sql , What is the best way?

    best regards

    kevin

    Thursday, March 19, 2020 8:50 AM

All replies

  • Hi Adisone,
    ADO.NET is a data access mechanism that allows you to execute sql commands to databases using plain sql queries and stored procedures. You would typically use the SQLCommand, SQLDataReader, SQLConnection and SQLDataAdapter objects to perform CRUD operations. 
    Entity Framework (EF) is also a data access mechanism, but it's an Object Relational Mapper (ORM). An ORM enables developers to create data access applications by programming against a conceptual application model instead of programming directly against a relational storage schema. This means that instead of writing SQL queries by yourself, you instead deal with object/classes and use LINQ to query against it. 
    Dataset designer is an older technology. The Entity Framework is microsoft's officially recommended data access technology. It is going to be using it in several of its major products moving forward.
    Entity Framework reduces your development time, improves code readability, type safety.
    If you are more concerned about performance, then go for ADO.NET implementation with ExecuteNonQuery. Otherwise, if you want to work with conceptual models/classes rather than dealing with hardcoded sql queries, then go for EF. 
    if you're starting a new project, go with Entity Framework, it now generates much better SQL (more like Linq to SQL does) and is easier to maintain and more powerful than Linq to SQL.
    More details you can refer to these documents. 
    [Entity Framework VS LINQ to SQL VS ADO.NET with stored procedures?]
    [What's the difference between datasets and the entity framework?]
    Hope these are helpful to you.
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 20, 2020 3:07 AM
  • ado.net entity framework is newer than LINQ and ADO.net DATASET?
    Monday, March 23, 2020 8:58 AM
  • Hi Adisone,
    EF(ado.net entity framework) is the new way of doings database interaction. And it now generates much better SQL (more like Linq to SQL does) and is easier to maintain and more powerful than Linq to SQL. 
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, March 23, 2020 9:38 AM
  • ado.net entity framework is newer than LINQ and ADO.net DATASET?

    DataSets have been around since the start of .NET.

    Which one to select is dependent on business requirements. In some cases using a data provider with a connection and command object or using a DataAdapter may be what is needed while in other cases a flavor of Entity Framework (Entity Framework 6 or Entity Framework Core).

    If you decide to use Entity Framework my recommendation is code first, existing database then use a scaffolding tool such as this one which is free and easy to use. A scaffolding tool gives you a head start on creating the needed DbContext and models. What you should not start with if going with Entity Framework 6 is anything other than code first until you get acquainted with the nuances of EF6. When going with EF Core go with 3.1.3 or higher version.

    Just because a technology is either old or new should not mean to discard the idea of using one or the other.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, March 30, 2020 7:13 PM