Entity Framework vs LINQ to SQL

后端 未结 17 1944
离开以前
离开以前 2020-11-22 09:25

Now that .NET v3.5 SP1 has been released (along with VS2008 SP1), we now have access to the .NET entity framework.

My question is this. When trying to decide betwee

相关标签:
17条回答
  • 2020-11-22 10:17

    I think the quick and dirty answer is that

    • LINQ to SQL is the quick-and-easy way to do it. This means you will get going quicker, and deliver quicker if you are working on something smaller.
    • Entity Framework is the all-out, no-holds-barred way to do it. This means you will take more time up-front, develop slower, and have more flexibility if you are working on something larger.
    0 讨论(0)
  • 2020-11-22 10:17

    You can find a good comparision here:

    http://www.dotnet-tricks.com/Tutorial/entityframework/1M5W300314-Difference-between-LINQ-to-SQL-and-Entity-Framework.html

    http://www.c-sharpcorner.com/blogs/entity-framework-vs-linq-to-sql1

    0 讨论(0)
  • 2020-11-22 10:20

    I think if you need to develop something quick with no Strange things in the middle, and you need the facility to have entities representing your tables:

    Linq2Sql can be a good allied, using it with LinQ unleashes a great developing timing.

    0 讨论(0)
  • 2020-11-22 10:21

    LINQ to SQL

    1. Homogeneous datasource: SQL Server
    2. Recommended for small projects only where data structure is well designed
    3. Mapping can be changed without recompilling with SqlMetal.exe
    4. .dbml (Database Markup Language)
    5. One-to-one mapping between tables and classes
    6. Supports TPH inheritance
    7. Doesn't support complex types
    8. Storage-first approach
    9. Database-centric view of a database
    10. Created by C# team
    11. Supported but not further improvements intended

    Entity Framework

    1. Heterogeneus datasource: Support many data providers
    2. Recommended for all new projects except:
      • small ones (LINQ to SQL)
      • when data source is a flat file (ADO.NET)
    3. Mapping can be changed without recompilling when setting model and mapping files Metadata Artifact Process to Copy To Output Directory
    4. .edmx (Entity Data Model) which contains:
      • SSDL (Storage Schema Definition Language)
      • CSDL (Conceptual Schema Definition Language)
      • MSL (Mapping Specification Language)
    5. One-to-one, one-to-many, many-to-one mappings between tables and classes
    6. Supports inheritence:
      • TPH (Table Per Hierarchy)
      • TPT (Table Per Type)
      • TPC (Table Per Concrete Class)
    7. Supports complex types
    8. Code-first, Model-first, Storage-first approaches
    9. Application-centric view of a database
    10. Created by SQL Server team
    11. Future of Microsoft Data APIs

    See also:

    • LINQ To SQL Vs Entity Framework
    • Difference between LINQ to SQL and Entity Framework
    • Entity Framework vs LINQ TO SQL
    0 讨论(0)
  • 2020-11-22 10:21

    Linq-to-SQL

    It is provider it supports SQL Server only. It's a mapping technology to map SQL Server database tables to .NET objects. Is Microsoft's first attempt at an ORM - Object-Relational Mapper.

    Linq-to-Entities

    Is the same idea, but using Entity Framework in the background, as the ORM - again from Microsoft, It supporting multiple database main advantage of entity framework is developer can work on any database no need to learn syntax to perform any operation on different different databases

    According to my personal experience Ef is better (if you have no idea about SQL) performance in LINQ is little bit faster as compare to EF reason LINQ language written in lambda.

    0 讨论(0)
提交回复
热议问题