What is the difference between LINQ to SQL and LINQ to Entities?

本文介绍了Microsoft的Language Integrated Query (LINQ) 和 Entity Framework 的基本概念及其相互关系。LINQ为.NET Framework提供了统一的数据查询能力,而Entity Framework通过LINQ to Entities提供了更灵活的对象关系映射方式。

      The ability to query relational stores other than the Microsoft SQL Server family of products.

What is LINQ?

Microsoft’s new Language Integrated Query (LINQ) is a set of extensions to the .NET Framework that provide common capabilities within the programming language for querying against in-memory data as well as external data sources.  LINQ complements our vision for an Entity Data Platform by providing language extensions for querying data as objects within the programming language.

Relations between LINQ & Entity Framework?

The ADO.NET Entity Framework will fully support LINQ through a feature known as “LINQ to Entities”. LINQ to Entities combines the developer experience of having query integrated into the programming language and the richness of being able to define an Entity Data Model with flexible mapping to relational stores.

What is the difference?

LINQ to SQL supports rapid development of applications that query Microsoft SQL Server databases using objects that map directly to SQL Server schemas.  LINQ to Entities supports more flexible mapping of objects to Microsoft SQL Server and other relational databases through extended ADO.NET Data Providers.

If you are writing an application that requires any of the following features, you should use the ADO.NET Entity Framework:

  •      The ability to define more flexible mapping to existing relational schema, for example:
    1.  Mapping a single class to multiple tables
    2.  Mapping to different types of inheritance
    3.  Directly Modeling Many to Many relationships
    4.  Mapping to an arbitrary query against the store
  •       The ability to share a model across Replication, Reporting Services, BI, Integration Services, etc.
  •       A full textual query language
  •       The ability to query a conceptual model without materializing results as objects

If you do not require any of these features, LINQ to SQL may provide a simpler solution for rapid development. LINQ to SQL is targeted at rapid-development scenarios against Microsoft SQL Server and provides a simpler approach and richer design experience in the Orcas timeframe for applications with data classes that map directly to the schema of your Microsoft SQL Server database.

Microsoft is defining a migration plan for customers that start with LINQ to SQL and require additional functionality, such as richer mapping capabilities or access to other stores, to migrate to the ADO.NET Entity Framework.

LINQ to SQL supports rapid development of applications that query Microsoft SQL Server databases using objects that map directly to SQL Server schemas. 

LINQ to Entities supports more flexible mapping of objects to Microsoft SQL Server and other relational databases through extended ADO.NET Data Providers

转载于:https://www.cnblogs.com/lochker/archive/2011/08/03/2125701.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值