zoukankan      html  css  js  c++  java
  • Entity Framework DB First 连接Linux云服务器Docker中的Sql Server

    程序包管理器控制台 选择数据库项目

    Scaffold-DbContext -Connection "Server=***.***.***.***;Database=test;User ID=sa;Password=********" -Provider "Microsoft.EntityFrameworkCore.SqlServer" -OutputDir "Models"

    使用工具的scaffold-dbcontext(数据库上下文脚手架)指令来生成models和context

    指令详细介绍:

    Scaffold-DbContext [-Connection] <String> [-Provider] <String> [-OutputDir <String>] [-Context <String>]
    [-Schemas <String>] [-Tables <String>] [-DataAnnotations] [-Force] [-Project <String>]
    [-StartupProject <String>] [-Environment <String>] [<CommonParameters>]

    PARAMETERS
    -Connection <String> 数据库的连接字符串。
    Specifies the connection string of the database.

    -Provider <String> 要使用的提供程序(例如 Microsoft.EntityFrameworkCore.SqlServer)
    Specifies the provider to use. For example, Microsoft.EntityFrameworkCore.SqlServer.

    -OutputDir <String> 要将文件放入的目录 路径是相对于项目目录。
    Specifies the directory to use to output the classes. If omitted, the top-level project directory is used.

    -Context <String> 若要生成的 dbcontext 名称
    Specifies the name of the generated DbContext class.

    -Schemas <String> 要生成实体类型的表架构
    Specifies the schemas for which to generate classes.

    -Tables <String> 要生成实体类型的表
    Specifies the tables for which to generate classes.

    -DataAnnotations [<SwitchParameter>] 使用属性来配置该模型 (如果可能)如果省略,则使用仅 fluent API
    Use DataAnnotation attributes to configure the model where possible. If omitted, the output code will use only the fluent API.

    -Force [<SwitchParameter>] 覆盖现有文件
    Force scaffolding to overwrite existing files. Otherwise, the code will only proceed if no output files would be overwritten.

    -Project <String>
    Specifies the project to use. If omitted, the default project is used.

    -StartupProject <String>
    Specifies the startup project to use. If omitted, the solution's startup project is used.

    -Environment <String>
    Specifies the environment to use. If omitted, "Development" is used.

  • 相关阅读:
    混合装置实现了24/7的能量收集和储存
    2020年人工智能汽车将出台多项标准
    自动驾驶汽车事故的责任追究
    多核处理器集成了神经处理单元
    广泛的信号处理链如何让语音助理“正常工作”
    先进机器人系统中的关键技术
    模拟内存计算如何解决边缘人工智能推理的功耗挑战
    TinyML设备设计的Arm内核
    获取url指定参数值(js/vue)
    js 实时监听textarea输入
  • 原文地址:https://www.cnblogs.com/OpenLJW/p/10190809.html
Copyright © 2011-2022 走看看