gpt4 book ai didi

.net - 从 EF 4 升级到 EF 5

转载 作者:行者123 更新时间:2023-12-03 22:21:21 31 4
gpt4 key购买 nike

我的应用程序基于 .NET 4.0 和 EF 4。我现在正在考虑升级到最新版本。

  • 是否有任何可能对我的申请产生不利影响的重大变化或行为差异?
  • 升级路径有多简单?升级到 EF 5 是否需要任何代码更改或其他工作?
  • 是否有任何与代码优先相关的新功能值得升级?
  • 最佳答案

    编辑:首先,EF 5/.NET 4.5 有一个主要问题,即永远不会支持 Windows XP 或 Server 2003(或更早版本)。如果您需要对其中任何一个操作系统的支持,请将 EF 4.4 与 .NET 4.0 一起使用,它没有任何有趣的新东西。

    此外,我遇到了与 DataAnnotations 移动命名空间相关的(简单)重大更改:

    Entity Framework 4.1 thru 4.3 included additional data annotations in the System.ComponentModel.DataAnnotations namespace in the EntityFramework assembly. In .NET 4.5 these annotations were moved to be part of the .NET Framework in the System.ComponentModel.DataAnnotations.Schema namespace of the System.ComponentModel.DataAnnotations.dll assembly. If you are using EF 4.x and targeting .NET 4.5 this results in two data annotations with the same name in different assemblies.



    http://blogs.msdn.com/b/adonet/archive/2012/02/29/ef4-3-1-and-ef5-beta-1-available-on-nuget.aspx ,这仍然适用于 EF 5 RTM。

    简而言之,我必须补充:
    using System.ComponentModel.DataAnnotations; // had this already
    using System.ComponentModel.DataAnnotations.Schema; // needed this one

    到无数地方。

    关于.net - 从 EF 4 升级到 EF 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12137939/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com