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.

  • 相关阅读:
    【数论】线性模方程
    【数论】拓展欧几里得
    BZOJ1433: [ZJOI2009]假期的宿舍
    BZOJ2823: [AHOI2012]信号塔
    BZOJ1088: [SCOI2005]扫雷Mine
    BZOJ1257: [CQOI2007]余数之和sum
    BZOJ1227: [SDOI2009]虔诚的墓主人
    BZOJ1856: [Scoi2010]字符串
    BZOJ1084: [SCOI2005]最大子矩阵
    BZOJ2007: [Noi2010]海拔
  • 原文地址:https://www.cnblogs.com/OpenLJW/p/10190809.html
Copyright © 2011-2022 走看看