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.

  • 相关阅读:
    【Java8】 @FunctionalInterface 函数式接口
    集合使用copy与mutableCopy的区别
    GCD中的dispatch_sync、dispatch_sync 分别与串行、并行队列组合执行小实验
    podspec文件介绍
    iOS系统app崩溃日志手动符号化
    webView文本长按显示英文
    深拷贝
    view向全屏延伸时的属性设置
    iOS 模拟器截屏快捷键
    mysql 优化常用语句
  • 原文地址:https://www.cnblogs.com/OpenLJW/p/10190809.html
Copyright © 2011-2022 走看看