在ASP.NET Core中使用实体框架6 [英] Using Entity Framework 6 in ASP.NET Core

查看:196
本文介绍了在ASP.NET Core中使用实体框架6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有:

  • 用于.NET Core框架的ASP.NET Core独立Web API项目
  • 具有用于完整.NET框架的EF6数据模型的类库

ASP.NET Core项目引用了类库

The ASP.NET Core project refers to the class library

此架构在这里提出:

https://docs.microsoft.com/zh-/aspnet/core/data/entity-framework-6

问题是:如果发行版(或发布)的依赖目标是完整的.NET Framework,我的独立应用程序是否能够在指定的目标平台(Win,Linux,Mac运行时)上执行?

The question is: will my standalone application be able to execute on the specified target platform (Win, Linux, Mac runtime) after Release (or Publish), if it's dependency targets to full .NET Framework?

非常感谢

推荐答案

不可能.您提供的相同链接可以确认:

It will be not possible. The same link you provided confirm that:

要使用Entity Framework 6,您的项目必须针对.NET Framework进行编译,因为Entity Framework 6不支持.NET Core.如果您需要跨平台功能,则需要升级到Entity Framework Core.

To use Entity Framework 6, your project has to compile against .NET Framework, as Entity Framework 6 does not support .NET Core. If you need cross-platform features you will need to upgrade to Entity Framework Core.

您可以在.NET Framework(不是.NET CORE)和EF6(但不能跨平台)上使用ASP.NET Core.但不是基于.NET Core的ASP.NET Core,而是使用EF6.您将需要对该项目使用EF Core.

You can use ASP.NET Core upon .NET Framework (Not .NET CORE) and EF6 (But not cross-platform). But not ASP.NET Core upon .NET Core and use EF6. You will need to use EF Core for that project.

这篇关于在ASP.NET Core中使用实体框架6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆