ADO.NET EF不方便之处(BUG)收集帖

考虑在项目中使用ADO.NET EF,但是怎么都用不顺手,甚至比L2S少了很多关键功能。

我先列几个让我很郁闷的(只用了不到5小时就遇到这么多问题):

1)存储过程自动封装是一个很常用的功能,在ADO.NET EF中可以和L2S一样对基本的INSERT/UPDATE/DELETE映射存储过程。

也可以对存储过程自动封装,把返回值是结果集的存储过程和实体进行关联,但是很吃惊的是:

     a) 设计器并没有提供对返回值不是实体(比如无返回值和标量返回值)的存储过程的自动生成,http://blogs.msdn.com/adonet/archive/2008/12/02/migrating-from-linq-to-sql-to-the-entity-framework-stored-procedures-for-data-retrieval.aspx 一文中一段

The LINQ to SQL Designer allows you to map stored procedures that return scalars. While the Entity Framework does have mapping support to specify stored procedures and functions that return scalars, automatic code-generation of methods that will allow you to use the mapping is currently missing. However, this is something that is being strongly considered for the next release of Entity Framework.

     b) 并不支持自定义实体的自动生成:

The Entity Framework does not automatically create return types whilst mapping stored procedures into functions.

It is possible to create the types by hand and to write additional code to execute the stored procedure and materialize the results.

 

2) 设计器不支持从领域模型直接生成数据库结构

3) UPDATE MODEL FROM DATABASE这个功能特别不方便,有的时候会重复生成关系

4) 没有提供LOG功能

 来看看老外的2个文章:

http://reddnet.net/code/ado-net-entity-framework-impressive-powerful-useless/

 The new Microsoft Entity Framework is the latest in a long line of very impressive, yet tragic failures in Microsoft's data access strategy...

这个开场白很寒,文中提到了延迟加载的问题,这位兄弟还是相当激动的。

http://www.kindblad.com/2009/01/11/why-you-should-not-use-the-adonet-entity-framework/

此文中也提到了我说的存储过程和更新模型的问题。

http://blogs.msdn.com/timmall/archive/2008/06/24/vote-of-no-confidence.aspx

此文是官方对社区反馈的一些解释。据说会在将来版本中改进下列方面:

1) 自定义POCO->EDM

2) EDM->关系型DB

3) 隐式延迟加载

4) 持久化透明

请大家补充,我都在想是不是放弃ADO.NET EF而使用SUBSONIC/L2S/NHIBERNATE等了。。。我的想法是不管是什么框架还是工具,易用性是第一的,让我们期待ADO.NET EF1.1/2.0!传说微软的东西不到2.0/3.0别去用?

posted @ 2009-01-15 15:49  lovecherry  阅读(5902)  评论(26编辑  收藏  举报