【问题标题】:Is it possible to use RIA Services and EntityFramework.Migrations together in a project?是否可以在项目中同时使用 RIA 服务和 EntityFramework.Migrations?
【发布时间】:2012-03-21 09:01:37
【问题描述】:

在 NuGet 上有包:

EntityFramework.Migrations
英孚 4.3.1
英孚 4.1
RIA 服务,依赖于 EF

EntityFramework.Migrations 不起作用,因为它现在包含在 EF 4.3+ 中

我使用的是 Code First 方法,因此我需要 DbDomainService 类,该类在未安装 RIA 服务时不可用。

上面是否有任何独立下载可以在我的项目中手动引用?

编辑

我从 NuGet 包中删除了 RIA,将 EF 升级到 4.3.1,然后按照此处的建议手动从工具包中引用 RIA EntityFramework lib:Can I use RIA Services with Entity Framework 4.3?

不幸的是,现在我收到以下错误:

The following exception occurred creating the MEF composition container:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
The default code generator will be used.

【问题讨论】:

    标签: entity-framework ef-code-first wcf-ria-services ria


    【解决方案1】:

    我猜您的问题与 Ria Services 的 T4 代码生成器有关。
    但是,您可以了解它无法加载的类型,将调试器附加到客户端程序集的编译(msbuild MyClientProjectThatContainTheProxy.csproj .)
    但是,如果你只是想“尝试一些东西”,就把这个

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.3.1.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    

    在您的 web.config 中,告诉 CLR 如何解决依赖关系。 更多信息在这里:http://mcasamento.blogspot.it/2012/10/entity-framework-5-code-first-and-wcf.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-30
      • 1970-01-01
      • 2021-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多