Entity Framework vs LINQ to SQL

后端 未结 17 2168
离开以前
离开以前 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: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

提交回复
热议问题