none
关于Entity Framework在大型数据库项目中应用的疑问 RRS feed

  • 问题

  • 最近有一个项目,大概需要操作50-100个数据库对象(可能不算大型),想用Entity Framework来写数据库访问层。

    但是有人说Entity Framework在与大型数据库工作时性能不是很理想,现在我也没找到Entity Framework有大型数据库应用项目的成功案例,所以心里还是没底,不知道有没有前辈已经在自己的项目中使用过EF,体验如何,谢谢了!

    2011年2月14日 3:46

答案

  • 50-100个数据对象 不能算大型

    通常说的大型数据库更多是指数据量方面,不仅仅是数据库表对象。

    如果您使用过某些ORM工具,那么你也可简单的认为Entity Framework也是一种ORM工具。其实对于企业应用和一些快速开发ORM工具都是很适合的,但是对于一些有着特殊性能要求的场景ORM工具不是很合适,毕竟ORM工具封装了太多了东西,可能会对性能带来负面影响。这个时候数据访问层还是定制构建比较合适。

     


    family as water
    • 已标记为答案 Cookie Luo 2011年2月21日 8:03
    2011年2月15日 7:50
  • 你好

    这个是一篇讨论Entity Framework性能的文章。可以先看看了解下。


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • 已标记为答案 Cookie Luo 2011年2月21日 8:03
    2011年2月15日 8:10
  • http://stackoverflow.com/questions/2981054/entity-framework-4-handling-very-large-1000-tables-data-models

    The number I heard in a Microsoft screencast is a maximum of roughly 250 tables per EF model. That doesn't mean EF can't handle more - it might just be sensible to break up your 1000+ tables into several logical groups of tables, and use one EF model per such logical group (with up to 250 tables in it).

    http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-1.aspx

    We have seen quite a few requests coming in from various folks asking for some guidance on best practices around working with large entity models in an Entity Framework application. The following post tries to describe the typical issues you would face when using a large entity model and tries to provide some guidance that hopefully will help mitigate some of these issues........

    http://drc.ideablade.com/xwiki/bin/view/Documentation/LargeModels

    It is impractical to build Entity Framework v.4 models with more than roughly 300 entity types. That's an unfortunate technical limitation but it shouldn't stop you.

    A 2009 essay, Large EF Models, describes the Entity Framework "large model problem" and the technical options available to you for breaking them up. It's a bit dated - it talks about EF v.1 - but still useful ... and the problem is still severe in Entity Framework version 4.

    We feel the EF technical obstacles should be irrelevant. We think the desire for large models is misplaced and that, even if technically feasible, you should avoid them. We feel that the best approach is to design large applications in modular fashion with several moderately sized models, one for each module "domain"......

    http://thedatafarm.com/blog/data-access/entity-framework-designer-and-large-databases/

    Entity Framework Designer and Large Databases

    • 已标记为答案 Cookie Luo 2011年2月21日 8:03
    2011年2月19日 3:18

全部回复

  • 50-100个数据对象 不能算大型

    通常说的大型数据库更多是指数据量方面,不仅仅是数据库表对象。

    如果您使用过某些ORM工具,那么你也可简单的认为Entity Framework也是一种ORM工具。其实对于企业应用和一些快速开发ORM工具都是很适合的,但是对于一些有着特殊性能要求的场景ORM工具不是很合适,毕竟ORM工具封装了太多了东西,可能会对性能带来负面影响。这个时候数据访问层还是定制构建比较合适。

     


    family as water
    • 已标记为答案 Cookie Luo 2011年2月21日 8:03
    2011年2月15日 7:50
  • 你好

    这个是一篇讨论Entity Framework性能的文章。可以先看看了解下。


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • 已标记为答案 Cookie Luo 2011年2月21日 8:03
    2011年2月15日 8:10
  • http://stackoverflow.com/questions/2981054/entity-framework-4-handling-very-large-1000-tables-data-models

    The number I heard in a Microsoft screencast is a maximum of roughly 250 tables per EF model. That doesn't mean EF can't handle more - it might just be sensible to break up your 1000+ tables into several logical groups of tables, and use one EF model per such logical group (with up to 250 tables in it).

    http://blogs.msdn.com/b/adonet/archive/2008/11/24/working-with-large-models-in-entity-framework-part-1.aspx

    We have seen quite a few requests coming in from various folks asking for some guidance on best practices around working with large entity models in an Entity Framework application. The following post tries to describe the typical issues you would face when using a large entity model and tries to provide some guidance that hopefully will help mitigate some of these issues........

    http://drc.ideablade.com/xwiki/bin/view/Documentation/LargeModels

    It is impractical to build Entity Framework v.4 models with more than roughly 300 entity types. That's an unfortunate technical limitation but it shouldn't stop you.

    A 2009 essay, Large EF Models, describes the Entity Framework "large model problem" and the technical options available to you for breaking them up. It's a bit dated - it talks about EF v.1 - but still useful ... and the problem is still severe in Entity Framework version 4.

    We feel the EF technical obstacles should be irrelevant. We think the desire for large models is misplaced and that, even if technically feasible, you should avoid them. We feel that the best approach is to design large applications in modular fashion with several moderately sized models, one for each module "domain"......

    http://thedatafarm.com/blog/data-access/entity-framework-designer-and-large-databases/

    Entity Framework Designer and Large Databases

    • 已标记为答案 Cookie Luo 2011年2月21日 8:03
    2011年2月19日 3:18