Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
304 views
in Technique[技术] by (71.8m points)

.net - 实体框架与LINQ to SQL(Entity Framework vs LINQ to SQL)

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

(现在已经发布了.NET v3.5 SP1(以及VS2008 SP1),我们现在可以访问.NET实体框架。)

My question is this.

(我的问题是这个。)

When trying to decide between using the Entity Framework and LINQ to SQL as an ORM, what's the difference?

(当尝试在使用实体框架和LINQ to SQL作为ORM之间做出决定时,有什么区别?)

The way I understand it, the Entity Framework (when used with LINQ to Entities) is a 'big brother' to LINQ to SQL?

(据我了解,实体框架(当与LINQ to Entities一起使用时)是LINQ to SQL的“老大哥”吗?)

If this is the case - what advantages does it have?

(如果是这样,它有什么优势?)

What can it do that LINQ to SQL can't do on its own?

(LINQ to SQL不能单独做什么?)

  ask by Chris Roberts translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

LINQ to SQL only supports 1 to 1 mapping of database tables, views, sprocs and functions available in Microsoft SQL Server.

(LINQ to SQL仅支持Microsoft SQL Server中可用的数据库表,视图,存储过程和函数的一对一映射。)

It's a great API to use for quick data access construction to relatively well designed SQL Server databases.

(这是一个很棒的API,可用于对相对设计良好的SQL Server数据库进行快速数据访问构建。)

LINQ2SQL was first released with C# 3.0 and .Net Framework 3.5.

(LINQ2SQL最初与C#3.0和.Net Framework 3.5一起发布。)

LINQ to Entities (ADO.Net Entity Framework) is an ORM (Object Relational Mapper) API which allows for a broad definition of object domain models and their relationships to many different ADO.Net data providers.

(LINQ to Entities(ADO.Net实体框架)是一个ORM(对象关系映射器)API,它允许对对象域模型及其与许多不同的ADO.Net数据提供者的关系进行广泛定义。)

As such, you can mix and match a number of different database vendors, application servers or protocols to design an aggregated mash-up of objects which are constructed from a variety of tables, sources, services, etc. ADO.Net Framework was released with the .Net Framework 3.5 SP1.

(这样,您可以混合并匹配许多不同的数据库供应商,应用程序服务器或协议,以设计由各种表,源,服务等构造的对象的聚合混搭。ADO.Net Framework随.Net Framework 3.5 SP1。)

This is a good introductory article on MSDN: Introducing LINQ to Relational Data

(这是有关MSDN的很好的介绍性文章:将LINQ引入关系数据)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...