asp.net-mvc - EF 核心和 Azure

标签 asp.net-mvc entity-framework azure-sql-database

我已经成功地实现了 EntityFramework Core 服务来与 SqlServer 一起工作,那么 Azure 呢?

这是我的代码: project.json 依赖:

"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0"

还有我的 Setup.cs:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        services.AddEntityFramework()
            .AddEntityFrameworkSqlServer()
            .AddDbContext<WorldContext>();
    }

是否有针对云 Azure 数据库的提供商?

最佳答案

只需使用 Azure 数据库的连接字符串。 Microsoft.EntityFrameworkCore.SqlServer 适用于常规 SQL Server 和 SQL Azure。

This database provider allows Entity Framework Core to be used with Microsoft SQL Server (including SQL Azure).

来源:https://docs.efproject.net/en/latest/providers/sql-server/index.html

关于asp.net-mvc - EF 核心和 Azure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38485246/

相关文章:

c# - 使用从数据库自动创建的模型中的 Entity Framework

c# - Entity Framework 更改主键类型

c# - CloudStorageAccount,发出 TableQuery 请求

c# - 有没有办法记录/跟踪从 WCF 服务发出的所有 SQL 查询?

asp.net - 将azure db添加到mvc5项目

asp.net-mvc - MVC 路由不处理我的目录之一

javascript - 为什么 jQuery selectable 无法正常工作?

asp.net-mvc - 为什么在 MVC 中将实体作为模型传递不是一个好主意?

c# - ASP.NET MVC 或者基于用户角色呈现 EditorFor

javascript - 拦截的表单提交在 jQuery 和 ASP.NET MVC 上生成阻塞 ajax 请求