无论如何在 .NET Core 中使用实体框架? [英] Is there anyway to use Entity Framework in .NET Core?

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

问题描述

我刚刚改用新的 ASP.NET 5 平台.我使用 Visual Studio 代码作为我的默认 IDE,并使用 DNX 来执行..NET Core 现在是默认设置,但我总是需要切换到 .NET Framework 我想引用 System.Data.Entity 命名空间或 TodoContext 类.

I've just changed to the new ASP.NET 5 platform. I use visual studio code as my default IDE, and DNX for execution. .NET Core is now by default but I need to switch to .NET Framework always I want to reference the System.Data.Entity namespace or the TodoContext class.

在 .NET Core 中是否可以使用 EF?

这就是我现在正在做的事情.

This is what I'm doing now.

推荐答案

System.Data 中的 EntityFramework 是版本 6.如果您想使用 .NET Core,则需要切换到 EF 7,它不再位于 System.Data 中,而是位于 EntityFramework.* nuget 包中.

The EntityFramework in System.Data is version 6. If you want to use .NET Core then you need to switch to EF 7 which no longer lives in System.Data but in the EntityFramework.* nuget packages.

这是一个例子:https://github.com/aspnet/MusicStore/blob/master/src/MusicStore/project.json#L15

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

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